2 @generated by mypy-protobuf. Do not edit manually!
6 import google.protobuf.descriptor
7 import google.protobuf.internal.containers
8 import google.protobuf.internal.well_known_types
9 import google.protobuf.message
11 import typing_extensions
13 DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ...
15 class FieldMask(google.protobuf.message.Message, google.protobuf.internal.well_known_types.FieldMask):
16 """`FieldMask` represents a set of symbolic field paths, for example:
21 Here `f` represents a field in some root message, `a` and `b`
22 fields in the message found in `f`, and `d` a field found in the
25 Field masks are used to specify a subset of fields that should be
26 returned by a get operation or modified by an update operation.
27 Field masks also have a custom JSON encoding (see below).
29 # Field Masks in Projections
31 When used in the context of a projection, a response message or
32 sub-message is filtered by the API to only contain those fields as
33 specified in the mask. For example, if the mask in the previous
34 example is applied to a response message as follows:
46 The result will not contain specific values for fields x,y and z
47 (their value will be set to the default, and omitted in proto text
58 A repeated field is not allowed except at the last position of a
61 If a FieldMask object is not present in a get operation, the
62 operation applies to all fields (as if a FieldMask of all fields
65 Note that a field mask does not necessarily apply to the
66 top-level response message. In case of a REST get operation, the
67 field mask applies directly to the response, but in case of a REST
68 list operation, the mask instead applies to each individual message
69 in the returned resource list. In case of a REST custom method,
70 other definitions may be used. Where the mask applies will be
71 clearly documented together with its declaration in the API. In
72 any case, the effect on the returned resource/resources is required
75 # Field Masks in Update Operations
77 A field mask in update operations specifies which fields of the
78 targeted resource are going to be updated. The API is required
79 to only change the values of the fields as specified in the mask
80 and leave the others untouched. If a resource is passed in to
81 describe the updated values, the API ignores the values of all
82 fields not covered by the mask.
84 If a repeated field is specified for an update operation, new values will
85 be appended to the existing repeated field in the target resource. Note that
86 a repeated field is only allowed in the last position of a `paths` string.
88 If a sub-message is specified in the last position of the field mask for an
89 update operation, then new value will be merged into the existing sub-message
90 in the target resource.
92 For example, given the target message:
102 And an update message:
111 then if the field mask is:
113 paths: ["f.b", "f.c"]
115 then the result will be:
125 An implementation may provide options to override this default behavior for
126 repeated and message fields.
128 In order to reset a field's value to the default, the field must
129 be in the mask and set to the default value in the provided resource.
130 Hence, in order to reset all fields of a resource, provide a default
131 instance of the resource and set all fields in the mask, or do
132 not provide a mask as described below.
134 If a field mask is not present on update, the operation applies to
135 all fields (as if a field mask of all fields has been specified).
136 Note that in the presence of schema evolution, this may mean that
137 fields the client does not know and has therefore not filled into
138 the request will be reset to their default. If this is unwanted
139 behavior, a specific service may require a client to always specify
140 a field mask, producing an error if not.
142 As with get operations, the location of the resource which
143 describes the updated values in the request message depends on the
144 operation kind. In any case, the effect of the field mask is
145 required to be honored by the API.
147 ## Considerations for HTTP REST
149 The HTTP kind of an update operation which uses a field mask must
150 be set to PATCH instead of PUT in order to satisfy HTTP semantics
151 (PUT must only be used for full updates).
153 # JSON Encoding of Field Masks
155 In JSON, a field mask is encoded as a single string where paths are
156 separated by a comma. Fields name in each path are converted
157 to/from lower-camel naming conventions.
159 As an example, consider the following message declarations:
166 string display_name = 1;
170 In proto a field mask for `Profile` may look as such:
173 paths: "user.display_name"
177 In JSON, the same mask is represented as below:
180 mask: "user.displayName,photo"
183 # Field Masks and Oneof Fields
185 Field masks treat fields in oneofs just as regular fields. Consider the
188 message SampleMessage {
191 SubMessage sub_message = 9;
195 The field mask can be:
207 Note that oneof type names ("test_oneof" in this case) cannot be used in
210 ## Field Mask Verification
212 The implementation of any API method which has a FieldMask type field in the
213 request should verify the included field paths, and return an
214 `INVALID_ARGUMENT` error if any path is unmappable.
216 DESCRIPTOR: google.protobuf.descriptor.Descriptor = ...
217 PATHS_FIELD_NUMBER: builtins.int
219 def paths(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[typing.Text]:
220 """The set of field mask paths."""
224 paths : typing.Optional[typing.Iterable[typing.Text]] = ...,
226 def ClearField(self, field_name: typing_extensions.Literal["paths",b"paths"]) -> None: ...
227 global___FieldMask = FieldMask