ReadonlyIGNORE_Always ignore rules, including the required rule.
This is useful for ignoring the rules of a referenced message, or to temporarily ignore rules during development.
message MyMessage {
// The field's rules will always be ignored, including any validations
// on value's fields.
MyOtherMessage value = 1 [
(buf.validate.field).ignore = IGNORE_ALWAYS
];
}
ReadonlyIGNORE_Ignore rules if the field is unset, or set to the zero value.
The zero value depends on the field type:
For fields that track presence (e.g. adding the optional label in proto3),
this a no-op and behavior is the same as the default IGNORE_UNSPECIFIED.
ReadonlyIGNORE_Ignore rules if the field tracks presence and is unset. This is the default behavior.
In proto3, only message fields, members of a Protobuf oneof, and fields
with the optional label track presence. Consequently, the following fields
are always validated, whether a value is set or not:
syntax="proto3";
message RulesApply {
string email = 1 [
(buf.validate.field).string.email = true
];
int32 age = 2 [
(buf.validate.field).int32.gt = 0
];
repeated string labels = 3 [
(buf.validate.field).repeated.min_items = 1
];
}
In contrast, the following fields track presence, and are only validated if a value is set:
syntax="proto3";
message RulesApplyIfSet {
optional string email = 1 [
(buf.validate.field).string.email = true
];
oneof ref {
string reference = 2 [
(buf.validate.field).string.uuid = true
];
string name = 3 [
(buf.validate.field).string.min_len = 4
];
}
SomeMessage msg = 4 [
(buf.validate.field).cel = {/* ... * /}
];
}
To ensure that such a field is set, add the required rule.
To learn which fields track presence, see the Field Presence cheat sheet.
Defines the static values of Ignore.