Skip to content

Commit 9a49527

Browse files
authored
feat(AIP-203): clarify fb in nested messages (#1182)
1 parent cc14482 commit 9a49527

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

aip/general/0203.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,26 @@ backwards-compatility. Nontheless, this annotation **must not** be omitted.
4242
only, and does not itself add any validation. The purpose is to consistently
4343
document this behavior for clients.
4444

45+
### field behavior of nested messages
46+
47+
`google.api.field_behavior` annotations on a nested message are independent of
48+
the annotations of the parent.
49+
50+
For example, a nested message can have a field behavior of `REQUIRED` while the
51+
parent field can be `OPTIONAL`:
52+
53+
```proto
54+
message Title {
55+
string text = 1 [(google.api.field_behavior) = REQUIRED];
56+
}
57+
58+
message Slide {
59+
Title title = 1 [(google.api.field_behavior) = OPTIONAL];
60+
}
61+
```
62+
63+
In the case above, if a `title` is specified, the `text` field is required.
64+
4565
## Vocabulary
4666

4767
### Identifier
@@ -246,6 +266,8 @@ surpass the costs to clients and API users of not doing so.
246266

247267
## Changelog
248268

269+
- **2023-09-14**: Clarify that nested behavior and parent behavior are
270+
independent.
249271
- **2023-08-25**: Add guidance on `IDENTIFIER`.
250272
- **2023-07-20**: Describe compatibility guidance with new section.
251273
- **2023-05-24**: Clarify that `IMMUTABLE` does not imply input nor required.

0 commit comments

Comments
 (0)