Skip to content

Commit a227f74

Browse files
authored
fix(AIP-149): add backwards compatibility section (#1366)
1 parent 294cfb0 commit a227f74

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

aip/general/0149.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ field behavior as defined in [AIP-203][]. For example, a field labeled with
5050
`google.api.field_behavior = REQUIRED` if the field must be set. If you only
5151
want to document the server perceived behavior of a field, read [AIP-203][].
5252

53+
### Backwards compatibility
54+
55+
It is a backwards incompatible change to add or remove the `optional` qualifier
56+
to an existing field. This is because the compiled src API is changed (in some
57+
languages). For example, in Golang, adding `optional` changes the field type of
58+
primitives to be the pointer variant of their original type, e.g. a field
59+
formerly of type `string` becomes `*string`, etc. Accordingly, this change
60+
requires that both clients and servers update their usage of the changed field
61+
in unison, which is risky and error prone. Additional information is
62+
[documented by Protobuf][proto docs].
63+
5364
## Rationale
5465

5566
### field behavior and `optional`
@@ -66,6 +77,8 @@ unrelated in practice and can reasonably be used together.
6677

6778
## Changelog
6879

80+
- **2024-06-05**: Add backwards compatibility considerations
6981
- **2023-06-20**: Differentiate from field behavior documentation
7082

7183
[AIP-203]: ./0203.md
84+
[proto docs]: https://protobuf.dev/programming-guides/field_presence/#considerations-for-change-compatibility

aip/general/0180.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,11 @@ version.
242242
- For understanding stability levels and expectations, see [AIP-181][].
243243
- For compatibility with client library resource name parsing, see [AIP-4231][]
244244
- For compatibility with client library method signatures, see [AIP-4232][]
245+
- For compatibility around field presence changes, see [AIP-149][].
245246

246247
## Changelog
247248

249+
- **2024-06-05**: Added reference to field presence compatibility.
248250
- **2023-07-26**: Added reference to field behavior compatibility.
249251
- **2023-07-26**: Added note on APIs which have limited clients.
250252
- **2022-08-11**: Added "Moving components between files" section.
@@ -254,6 +256,7 @@ version.
254256

255257
<!-- prettier-ignore-start -->
256258
[aip-122]: ./0122.md
259+
[aip-149]: ./0149.md
257260
[aip-151]: ./0151.md
258261
[aip-158]: ./0158.md
259262
[aip-181]: ./0181.md

0 commit comments

Comments
 (0)