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.
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.
Optional[customReturns a safe value for JSON logs.
Returns a safe value for JSON logs.
Optional[unknownPreserves protobuf fields that this SDK version does not recognize.
Contains the fully qualified protobuf type name.
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).
OptionalisMark 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.
OptionalnidFor 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.
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:
In this example,
field1inMyMessage2is required, even if it is not required inMyMessage. The following example will override the setting again:In this example,
field1inMyMessage2is not required for theMyMethod, even if it is required inMyMessage2.