Skip to content

Commit 221bdb4

Browse files
authored
chore(AIP-156): require singular and plural in resource (#1328)
1 parent c26449d commit 221bdb4

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

aip/general/0156.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ message Config {
2626
option (google.api.resource) = {
2727
type: "api.googleapis.com/Config"
2828
pattern: "users/{user}/config"
29+
singular: "config"
30+
plural: "configs"
2931
};
3032
3133
// additional fields including name
@@ -55,6 +57,8 @@ rpc UpdateConfig(UpdateConfigRequest) returns (Config) {
5557
- Example: `users/1234/config`
5658
- Singleton resources are always singular.
5759
- Example: `users/1234/thing`
60+
- Singleton resource defintions **must** provide both the `singular` and
61+
`plural` fields (see above example).
5862
- Singleton resources **may** parent other resources.
5963
- Singleton resources **must not** define the [`Create`][aip-133] or
6064
[`Delete`][aip-135] standard methods. The singleton is implicitly created or
@@ -108,8 +112,16 @@ Furthermore, presenting the Singleton resource as a pseudo-collection in such
108112
methods enables future expansion to a real collection, should a Singleton be
109113
found lacking.
110114

115+
### Including `plural` definition
116+
117+
While a Singleton is by definition singular, there are certain cases where
118+
a Singleton resource may appear in a plural form e.g., if the service supports
119+
Standard List (as defined here). As such, it is better to forward declare the
120+
plural form of the Singleton resource type than to not have it when needed.
121+
111122
## Changelog
112123

124+
- **2024-04-15:** Singletons must specify `singular` and `plural` in resource.
113125
- **2023-08-10:** Add Standard `List` support.
114126
- **2023-07-26:** Clarified that read-only singletons should not have `Update`.
115127
- **2021-11-02:** Added an example message and state parent eligibility.

0 commit comments

Comments
 (0)