Package build.buf.validate
Enum Class Ignore
- All Implemented Interfaces:
com.google.protobuf.Internal.EnumLite,com.google.protobuf.ProtocolMessageEnum,Serializable,Comparable<Ignore>,Constable
Specifies how FieldConstraints.ignore behaves. See the documentation for FieldConstraints.required for definitions of "populated" and "nullable".Protobuf enum
buf.validate.Ignore-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe validation rules of this field will be skipped and not evaluated.Validation is skipped if the field is unpopulated or if it is a nullable field populated with its default value.Validation is skipped if the field is unpopulated.Validation is only skipped if it's an unpopulated nullable fields. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe validation rules of this field will be skipped and not evaluated.static final IgnoreDeprecated: Use IGNORE_IF_DEFAULT_VALUE.static final intDeprecated.static final IgnoreDeprecated: Use IGNORE_IF_UNPOPULATED instead.static final intDeprecated.static final intValidation is skipped if the field is unpopulated or if it is a nullable field populated with its default value.static final intValidation is skipped if the field is unpopulated.static final intValidation is only skipped if it's an unpopulated nullable fields. -
Method Summary
Modifier and TypeMethodDescriptionstatic IgnoreforNumber(int value) static final com.google.protobuf.Descriptors.EnumDescriptorfinal com.google.protobuf.Descriptors.EnumDescriptorfinal intfinal com.google.protobuf.Descriptors.EnumValueDescriptorstatic com.google.protobuf.Internal.EnumLiteMap<Ignore>static IgnorevalueOf(int value) Deprecated.static IgnorevalueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) Returns the enum constant of this class with the specified name.static IgnoreReturns the enum constant of this class with the specified name.static Ignore[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
IGNORE_UNSPECIFIED
Validation is only skipped if it's an unpopulated nullable fields. ```proto syntax="proto3"; message Request { // The uri rule applies to any value, including the empty string. string foo = 1 [ (buf.validate.field).string.uri = true ]; // The uri rule only applies if the field is set, including if it's // set to the empty string. optional string bar = 2 [ (buf.validate.field).string.uri = true ]; // The min_items rule always applies, even if the list is empty. repeated string baz = 3 [ (buf.validate.field).repeated.min_items = 3 ]; // The custom CEL rule applies only if the field is set, including if // it's the "zero" value of that message. SomeMessage quux = 4 [ (buf.validate.field).cel = {/* ... */} ]; } ```IGNORE_UNSPECIFIED = 0; -
IGNORE_IF_UNPOPULATED
Validation is skipped if the field is unpopulated. This rule is redundant if the field is already nullable. This value is equivalent behavior to the deprecated ignore_empty rule. ```proto syntax="proto3 message Request { // The uri rule applies only if the value is not the empty string. string foo = 1 [ (buf.validate.field).string.uri = true, (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; // IGNORE_IF_UNPOPULATED is equivalent to IGNORE_UNSPECIFIED in this // case: the uri rule only applies if the field is set, including if // it's set to the empty string. optional string bar = 2 [ (buf.validate.field).string.uri = true, (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; // The min_items rule only applies if the list has at least one item. repeated string baz = 3 [ (buf.validate.field).repeated.min_items = 3, (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; // IGNORE_IF_UNPOPULATED is equivalent to IGNORE_UNSPECIFIED in this // case: the custom CEL rule applies only if the field is set, including // if it's the "zero" value of that message. SomeMessage quux = 4 [ (buf.validate.field).cel = {/* ... */}, (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; } ```IGNORE_IF_UNPOPULATED = 1; -
IGNORE_IF_DEFAULT_VALUE
Validation is skipped if the field is unpopulated or if it is a nullable field populated with its default value. This is typically the zero or empty value, but proto2 scalars support custom defaults. For messages, the default is a non-null message with all its fields unpopulated. ```proto syntax="proto3 message Request { // IGNORE_IF_DEFAULT_VALUE is equivalent to IGNORE_IF_UNPOPULATED in // this case; the uri rule applies only if the value is not the empty // string. string foo = 1 [ (buf.validate.field).string.uri = true, (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE ]; // The uri rule only applies if the field is set to a value other than // the empty string. optional string bar = 2 [ (buf.validate.field).string.uri = true, (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE ]; // IGNORE_IF_DEFAULT_VALUE is equivalent to IGNORE_IF_UNPOPULATED in // this case; the min_items rule only applies if the list has at least // one item. repeated string baz = 3 [ (buf.validate.field).repeated.min_items = 3, (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE ]; // The custom CEL rule only applies if the field is set to a value other // than an empty message (i.e., fields are unpopulated). SomeMessage quux = 4 [ (buf.validate.field).cel = {/* ... */}, (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE ]; } ``` This rule is affected by proto2 custom default values: ```proto syntax="proto2"; message Request { // The gt rule only applies if the field is set and it's value is not the default (i.e., not -42). The rule even applies if the field is set to zero since the default value differs. optional int32 value = 1 [ default = -42, (buf.validate.field).int32.gt = 0, (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE ]; }IGNORE_IF_DEFAULT_VALUE = 2; -
IGNORE_ALWAYS
The validation rules of this field will be skipped and not evaluated. This is useful for situations that necessitate turning off the rules of a field containing a message that may not make sense in the current context, or to temporarily disable constraints during development. ```proto message MyMessage { // The field's rules will always be ignored, including any validation's // on value's fields. MyOtherMessage value = 1 [ (buf.validate.field).ignore = IGNORE_ALWAYS]; } ```IGNORE_ALWAYS = 3; -
UNRECOGNIZED
-
-
Field Details
-
IGNORE_EMPTY
Deprecated: Use IGNORE_IF_UNPOPULATED instead. TODO: Remove this value pre-v1.
IGNORE_EMPTY = 1 [deprecated = true]; -
IGNORE_DEFAULT
Deprecated: Use IGNORE_IF_DEFAULT_VALUE. TODO: Remove this value pre-v1.
IGNORE_DEFAULT = 2 [deprecated = true]; -
IGNORE_UNSPECIFIED_VALUE
public static final int IGNORE_UNSPECIFIED_VALUEValidation is only skipped if it's an unpopulated nullable fields. ```proto syntax="proto3"; message Request { // The uri rule applies to any value, including the empty string. string foo = 1 [ (buf.validate.field).string.uri = true ]; // The uri rule only applies if the field is set, including if it's // set to the empty string. optional string bar = 2 [ (buf.validate.field).string.uri = true ]; // The min_items rule always applies, even if the list is empty. repeated string baz = 3 [ (buf.validate.field).repeated.min_items = 3 ]; // The custom CEL rule applies only if the field is set, including if // it's the "zero" value of that message. SomeMessage quux = 4 [ (buf.validate.field).cel = {/* ... */} ]; } ```IGNORE_UNSPECIFIED = 0;- See Also:
-
IGNORE_IF_UNPOPULATED_VALUE
public static final int IGNORE_IF_UNPOPULATED_VALUEValidation is skipped if the field is unpopulated. This rule is redundant if the field is already nullable. This value is equivalent behavior to the deprecated ignore_empty rule. ```proto syntax="proto3 message Request { // The uri rule applies only if the value is not the empty string. string foo = 1 [ (buf.validate.field).string.uri = true, (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; // IGNORE_IF_UNPOPULATED is equivalent to IGNORE_UNSPECIFIED in this // case: the uri rule only applies if the field is set, including if // it's set to the empty string. optional string bar = 2 [ (buf.validate.field).string.uri = true, (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; // The min_items rule only applies if the list has at least one item. repeated string baz = 3 [ (buf.validate.field).repeated.min_items = 3, (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; // IGNORE_IF_UNPOPULATED is equivalent to IGNORE_UNSPECIFIED in this // case: the custom CEL rule applies only if the field is set, including // if it's the "zero" value of that message. SomeMessage quux = 4 [ (buf.validate.field).cel = {/* ... */}, (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; } ```IGNORE_IF_UNPOPULATED = 1;- See Also:
-
IGNORE_IF_DEFAULT_VALUE_VALUE
public static final int IGNORE_IF_DEFAULT_VALUE_VALUEValidation is skipped if the field is unpopulated or if it is a nullable field populated with its default value. This is typically the zero or empty value, but proto2 scalars support custom defaults. For messages, the default is a non-null message with all its fields unpopulated. ```proto syntax="proto3 message Request { // IGNORE_IF_DEFAULT_VALUE is equivalent to IGNORE_IF_UNPOPULATED in // this case; the uri rule applies only if the value is not the empty // string. string foo = 1 [ (buf.validate.field).string.uri = true, (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE ]; // The uri rule only applies if the field is set to a value other than // the empty string. optional string bar = 2 [ (buf.validate.field).string.uri = true, (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE ]; // IGNORE_IF_DEFAULT_VALUE is equivalent to IGNORE_IF_UNPOPULATED in // this case; the min_items rule only applies if the list has at least // one item. repeated string baz = 3 [ (buf.validate.field).repeated.min_items = 3, (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE ]; // The custom CEL rule only applies if the field is set to a value other // than an empty message (i.e., fields are unpopulated). SomeMessage quux = 4 [ (buf.validate.field).cel = {/* ... */}, (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE ]; } ``` This rule is affected by proto2 custom default values: ```proto syntax="proto2"; message Request { // The gt rule only applies if the field is set and it's value is not the default (i.e., not -42). The rule even applies if the field is set to zero since the default value differs. optional int32 value = 1 [ default = -42, (buf.validate.field).int32.gt = 0, (buf.validate.field).ignore = IGNORE_IF_DEFAULT_VALUE ]; }IGNORE_IF_DEFAULT_VALUE = 2;- See Also:
-
IGNORE_ALWAYS_VALUE
public static final int IGNORE_ALWAYS_VALUEThe validation rules of this field will be skipped and not evaluated. This is useful for situations that necessitate turning off the rules of a field containing a message that may not make sense in the current context, or to temporarily disable constraints during development. ```proto message MyMessage { // The field's rules will always be ignored, including any validation's // on value's fields. MyOtherMessage value = 1 [ (buf.validate.field).ignore = IGNORE_ALWAYS]; } ```IGNORE_ALWAYS = 3;- See Also:
-
IGNORE_EMPTY_VALUE
Deprecated.Deprecated: Use IGNORE_IF_UNPOPULATED instead. TODO: Remove this value pre-v1.
IGNORE_EMPTY = 1 [deprecated = true];- See Also:
-
IGNORE_DEFAULT_VALUE
Deprecated.Deprecated: Use IGNORE_IF_DEFAULT_VALUE. TODO: Remove this value pre-v1.
IGNORE_DEFAULT = 2 [deprecated = true];- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getNumber
public final int getNumber()- Specified by:
getNumberin interfacecom.google.protobuf.Internal.EnumLite- Specified by:
getNumberin interfacecom.google.protobuf.ProtocolMessageEnum
-
valueOf
Deprecated.Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
value- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
forNumber
- Parameters:
value- The numeric wire value of the corresponding enum entry.- Returns:
- The enum associated with the given numeric wire value.
-
internalGetValueMap
-
getValueDescriptor
public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor()- Specified by:
getValueDescriptorin interfacecom.google.protobuf.ProtocolMessageEnum
-
getDescriptorForType
public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType()- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.ProtocolMessageEnum
-
getDescriptor
public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() -
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
desc- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-