Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(AIP-203): Disallow OUTPUT_ONLY fields with OPTIONAL/REQUIRED sub… #1276

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andrei-scripniciuc
Copy link
Contributor

Nested messages allow avoiding code duplication, where the same type can be shared by multiple messages. Given that field behavior annotations are also required for nested messages, field behavior must also implicitly be shared.

Annotating a field with OUTPUT_ONLY, when the field is a sub-message declaring REQUIRED and/or OPTIONAL fields, forces clients to treat this sub-message differently depending on the context it is used in. Forcing services to consistently separate output fields from user-defined fields avoids this problem.

Additionally, there is little value in annotating sub-fields of OUTPUT_ONLY fields as either REQUIRED or OPTIONAL, since the consequences of breaking this contract by services still have to be handled by clients, and clients must be able to accept the current state of a resource regardless.

…-fields

Nested messages allow avoiding code duplication, where the same type can be shared
by multiple messages. Given that field behavior annotations are also required for
nested messages, field behavior must also implicitly be shared. Annotating a field
with `OUTPUT_ONLY`, when the field is a sub-message declaring `REQUIRED` and/or
`OPTIONAL` fields, forces clients to treat this sub-message differently depending
on the context it is used in. Forcing services to consistently separate output
fields from user-defined fields avoids this problem. Additionally, there is little
value in annotating sub-fields of `OUTPUT_ONLY` fields as either `REQUIRED` or
`OPTIONAL`, since the consequences of breaking this contract by services still
have to be handled by clients.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant