class SubfieldSettings(pb_classes.Message): (source)
Constructor: SubfieldSettings(initial_message, field_path, nid, is_required)
SubfieldSettings describes overrides for some settings for subfields of a field. Overrides are applied to fields in order of appearance, so the first matching override is applied, and the rest are ignored.
Example:
message MyMessage {
string field1 = 1;
}
message MyMessage2 {
MyMessage field2 = 1 [(subfield_settings) = { field_path: "field1", is_required: true }];
}In this example, field1 in MyMessage2 is required, even if it is not required in MyMessage. The following example will override the setting again:
service MyService {
rpc MyMethod(MyMessage2) returns (MyMessage2) {
option (method_behavior) = METHOD_UPDATER;
option (request_fields) = { field_path: "field2.field1", is_required: false };
}
}In this example, field1 in MyMessage2 is not required for the MyMethod, even if it is required in MyMessage2.
| Class | __ |
Undocumented |
| Class | __ |
Undocumented |
| Method | __dir__ |
Undocumented |
| Method | __init__ |
Create a wrapper around a protobuf message instance. |
| Method | field |
Undocumented |
| Method | is |
Undocumented |
| Method | nid |
Undocumented |
| Constant | __PB2 |
Undocumented |
| Constant | __PY |
Undocumented |
| Class Variable | __mask |
Undocumented |
| Property | field |
Subfield path in the message, for example metadata.parent_id or metadata.name. Must be a valid SelectMask. May match several fields, if necessary. For example, some.*.subfield or some.(subfield,another_field)... |
| Property | is |
Mark a field as required, even if it is not required in the message it contains. Unlike cel expressions, this setting can be reflected in tools documentation and help messages. |
| Property | nid |
For fields annotated with this option, values are treated as NIDs and warnings are emitted when they are not valid. These warnings are separate from server-side validation. |
| Property | _is |
Undocumented |
Inherited from Message:
| Class Method | get |
Return the protobuf descriptor for this message class. |
| Class Method | is |
Return True if the field contains credentials. |
| Class Method | is |
Return True if the field is marked as sensitive. |
| Method | __repr__ |
Return a human-readable representation of the message, sanitizing sensitive fields. |
| Method | check |
Check explicit presence for a field in the protobuf message. |
| Method | get |
Build a reset mask for a full update of this message. |
| Method | get |
Return the tracked reset mask. |
| Method | is |
Return True if a field equals its default value. |
| Method | set |
Replace the tracked reset mask. |
| Method | which |
Return the set field name for a given oneof. |
| Instance Variable | __PB2 |
Protobuf message class associated with this wrapper. |
| Instance Variable | __pb2 |
Underlying protobuf message instance. |
| Method | _clear |
Clear a field and record it in the reset mask. |
| Method | _get |
Return a field value with optional wrapping and presence handling. |
| Method | _set |
Set a field value and update the reset mask. |
| Class Variable | __credentials |
Undocumented |
| Class Variable | __default |
Undocumented |
| Class Variable | __sensitive |
Undocumented |
| Instance Variable | __recorded |
Mask tracking fields cleared or set to default. |
message.Message | None = None, *, field_path: builtins.str | None | unset.UnsetType = unset.Unset, nid: NIDFieldSettings | annotations_pb2.NIDFieldSettings | None | unset.UnsetType = unset.Unset, is_required: builtins.bool | None | unset.UnsetType = unset.Unset):
(source)
¶
Create a wrapper around a protobuf message instance.
| Raises | |
AttributeError | If the wrapper is missing required class metadata. |
def nid(self, value:
NIDFieldSettings | annotations_pb2.NIDFieldSettings | None):
(source)
¶
Undocumented
Undocumented
| Value |
|
Undocumented
| Value |
|
Subfield path in the message, for example metadata.parent_id or metadata.name. Must be a valid SelectMask. May match several fields, if necessary. For example, some.*.subfield or some.(subfield,another_field).
Mark a field as required, even if it is not required in the message it contains. Unlike cel expressions, this setting can be reflected in tools documentation and help messages.
For fields annotated with this option, values are treated as NIDs and warnings are emitted when they are not valid. These warnings are separate from server-side validation.