WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

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.

1 participant