Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion aip/general/0126.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: 126
state: approved
created: 2019-07-24
updated: 2026-10-22
updated: 2026-11-04
placement:
category: resource-design
order: 60
Expand Down Expand Up @@ -81,7 +81,15 @@ CallInitiationStatic:
format: int64
```

### Update (PATCH)

Partial updates of a discriminated-union field follow
[AIP-134](./0134.md#discriminated-unions-on-update): the patch object must
include `kind`; same-kind patches merge fields; a different `kind` replaces the
variant. Create, Replace, and responses still use the full variant shapes above.

## Further reading

- [Update and Replace](./0134.md)
- [Field names](./0140.md)

22 changes: 21 additions & 1 deletion aip/general/0134.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: 134
state: approved
created: 2019-01-24
updated: 2026-10-27
updated: 2026-11-04
placement:
category: operations
order: 40
Expand Down Expand Up @@ -31,6 +31,9 @@ Public APIs use two write styles: partial Update and full Replace.
- Members omitted from the patch are left unchanged
- Nested objects are merged recursively
- Arrays are replaced as a whole (not merged element-wise). JSON `null` clears the array. `null` and `[]` are equivalent. Omitting the field leaves the current array unchanged
- [Discriminated unions](./0126.md) on Update follow
[Discriminated unions on Update](#discriminated-unions-on-update) (they are
not a plain recursive object merge across kinds)
- The patch object **must not** include read-only fields such as `id`,
`created_timestamp`, or `updated_timestamp`. If sent, servers **must**
ignore them or reject the request ([AIP-129](./0129.md)).
Expand All @@ -45,6 +48,22 @@ Public APIs use two write styles: partial Update and full Replace.
- State transitions that are product actions (pause, resume, cancel) **must
not** be modeled as PATCH field writes; use [custom methods](./0136.md).

#### Discriminated unions on Update

When a PATCH field is a [discriminated union](./0126.md):

- The patch object **must** include `kind`. Omitting `kind` is invalid.
- When `kind` matches the current value, servers **must** merge present members
into that variant. Members omitted from the patch are left unchanged.
- When `kind` differs from the current value, servers **must** replace the
variant. Omitted fields that have a product default **may** use that default
(for example a delay of `0`). Fields with no default that are required on
create for that variant **must** be present or the request is invalid.
- Members that do not belong to the stated `kind` **must** be rejected with a
clear client error naming the invalid member and the kind.
- Create, Replace, and response bodies still use the full variant shapes from
[AIP-126](./0126.md).

```http
PATCH /beta/books/AUIAE-DUXA
Content-Type: application/json
Expand Down Expand Up @@ -102,6 +121,7 @@ Content-Type: application/json

## Further reading

- [Enumerations and unions](./0126.md)
- [Singletons](./0156.md)
- [Custom methods](./0136.md)
- [Field behavior](./0203.md)