Skip to content

Commit 2ad98dc

Browse files
authored
Default field_mask value and deprecate on request. (#853)
* Default value and deprecate on request. Explicitly document default value for field mask. Deprecate field mask on request. * Removed recommended/deprecated from headings. * jskeet suggestions
1 parent fe5ed79 commit 2ad98dc

1 file changed

Lines changed: 10 additions & 21 deletions

File tree

aip/general/0157.md

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,26 @@ needs to give the user control over which fields it sends back.
1414

1515
## Guidance
1616

17-
APIs **may** support partial responses in one of the three ways:
17+
APIs **may** support partial responses in one of two ways:
1818

1919
### Field masks parameter
2020

2121
Field masks (`google.protobuf.FieldMask`) can be used for granting the user
22-
fine-grained control over what fields are returned. It is generally the
23-
recommended way for an API to support partial responses.
22+
fine-grained control over what fields are returned. An API **should** support the mask in a side channel.
23+
For example, the parameter can be specified either using an HTTP query
24+
parameter, an HTTP header, or a [gRPC metadata entry][1]. Google Cloud APIs specify field masks as a [system parameter][0].
2425

25-
To enable field masks, an API **should** support the masks as a [system parameter][0].
26-
This parameter can be specified either using an HTTP query
27-
parameter or an HTTP header (or a [gRPC metadata entry][1]).
26+
Field masks **should not** be specified in the [request](./0157.md#read-masks-as-a-request-field).
2827

2928
- The value of the field mask parameter **must** be a `google.protobuf.FieldMask`.
30-
- The field mask parameter **should** be specified using `$field` as a query parameter or `X-Goog-FieldMask` as an HTTP header.
3129
- The field mask parameter **must** be optional:
3230
- An explicit value of `"*"` **should** be supported, and **must** return all
3331
fields.
34-
- If the field mask parameter is not provided, all fields **must** be
35-
returned.
32+
- If the field mask parameter is omitted, it **must** default to `"*"`, unless otherwise documented.
3633
- An API **may** allow read masks with non-terminal repeated fields (unlike
3734
update masks), but is not obligated to do so.
35+
36+
**Note:** Changing the default value of the field mask parameter is a [breaking change](../0180.md#semantic-changes).
3837

3938
### View enumeration
4039

@@ -78,21 +77,11 @@ enum BookView {
7877

7978
### Read masks as a request field
8079

81-
Similar to a system parameter, an API **may** support read masks as a single field on the request
82-
message: `google.protobuf.FieldMask read_mask`.
83-
84-
- The read mask **must** be a `google.protobuf.FieldMask` and **should** be
85-
named `read_mask`.
86-
- The field mask **should** be optional:
87-
- An explicit value of `"*"` **should** be supported, and **must** return all
88-
fields.
89-
- If the field mask parameter is not provided, all fields **must** be
90-
returned.
91-
- An API **may** allow read masks with non-terminal repeated fields (unlike
92-
update masks), but is not obligated to do so.
80+
**Warning:** Read masks as a single field on the request message, for example: `google.protobuf.FieldMask read_mask` are **DEPRECATED**.
9381

9482
## Changelog
9583

84+
- **2022-03-14:** Updated guidance on default value and how to specify a read mask.
9685
- **2021-10-06:** Updated the guidance with system parameters.
9786
- **2021-03-04:** Added guidance for conflicting view enums.
9887

0 commit comments

Comments
 (0)