Skip to content

Commit

Permalink
fix(AIP-156): Do not define Update on singletons with only output onl…
Browse files Browse the repository at this point in the history
…y fields. (#1188)

Clarifying that singletons with only OUTPUT_ONLY fields do not require an Update method.
  • Loading branch information
lukesneeringer committed Aug 4, 2023
1 parent 55797f4 commit e6d1b76
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion aip/general/0156.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ always exist by virtue of the existence of its parent, with one and exactly one
per parent.

For example:

```proto
message Config {
option (google.api.resource) = {
Expand All @@ -32,6 +33,7 @@ message Config {
```

The `Config` singleton would have the following RPCs:

```proto
rpc GetConfig(GetConfigRequest) returns (Config) {
option (google.api.http) = {
Expand All @@ -57,12 +59,15 @@ rpc UpdateConfig(UpdateConfigRequest) returns (Config) {
- Singleton resources **should** define the [`Get`][aip-131] and
[`Update`][aip-134] methods, and **may** define custom methods as
appropriate.
- However, singleton resources **must not** define the [`Update`][aip-134]
method if all fields on the resource are [output only][aip-203].
- Singleton resources are always singular.
- Example: 'users/1234/thing'
- Example: `users/1234/thing`
- Singleton resources **may** parent other resources.

## Changelog

- **2023-07-26:** Clarified that read-only singletons should not have `Update`.
- **2021-11-02:** Added an example message and state parent eligibility.
- **2021-01-14:** Changed example from `settings` to `config` for clarity.

Expand All @@ -72,3 +77,4 @@ rpc UpdateConfig(UpdateConfigRequest) returns (Config) {
[aip-133]: ./0133.md
[aip-134]: ./0134.md
[aip-135]: ./0135.md
[aip-203]: ./0203.md#output-only

0 comments on commit e6d1b76

Please sign in to comment.