Skip to content

Commit c74c792

Browse files
authored
fix(AIP-122): clarify shortening rules for nested collections (#1372)
1 parent c40c5a6 commit c74c792

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

aip/general/0122.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,28 @@ An API **should** use the less-redundant form:
9999
users/vhugo1802/events/birthday-dinner-226
100100
```
101101

102-
In this situation, the _message_ is still called `UserEvent`; only the resource
103-
name is shortened.
102+
In this situation, the _message_ and _resource type_ are still called
103+
`UserEvent`; only the collection and resource identifiers in the pattern(s) are
104+
shortened. Since the _resource type_ is not shortened, the `singular` and
105+
`plural` are similarly _not shortened_.
106+
107+
```
108+
message UserEvent {
109+
option (google.api.resource) = {
110+
type: "example.googleapis.com/UserEvent"
111+
// Only the collection & resource identfiers in the `pattern` are shortened.
112+
pattern: "projects/{project}/users/{user}/events/{event}"
113+
singular: "userEvent"
114+
plural: "userEvents"
115+
};
116+
117+
string name = 1;
118+
}
119+
```
104120

105121
**Note:** APIs wishing to do this **must** follow this format consistently
106-
throughout the API, or else not at all.
122+
throughout all of its `pattern` entries defined and anywhere else the
123+
resource is referenced in the API, or else not at all.
107124

108125
### Resource ID segments
109126

@@ -357,6 +374,8 @@ isolation of logical concerns per-resource.
357374

358375
## Changelog
359376

377+
- **2024-06-14**: Clarify resource annotation shortening rules for nested
378+
collections.
360379
- **2023-09-19**: Prohibit duplicate collection identifiers.
361380
- **2023-09-01**: Add a clause that allows embedding for revision resource
362381
messages.

0 commit comments

Comments
 (0)