Enum Class Ignore

java.lang.Object
java.lang.Enum<Ignore>
build.buf.validate.Ignore
All Implemented Interfaces:
com.google.protobuf.Internal.EnumLite, com.google.protobuf.ProtocolMessageEnum, Serializable, Comparable<Ignore>, Constable

public enum Ignore extends Enum<Ignore> implements com.google.protobuf.ProtocolMessageEnum
 Specifies how FieldConstraints.ignore behaves. See the documentation for
 FieldConstraints.required for definitions of "populated" and "nullable".
 
Protobuf enum buf.validate.Ignore
  • Enum Constant Details

    • IGNORE_UNSPECIFIED

      public static final Ignore 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

      public static final Ignore 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

      public static final Ignore 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

      public static final Ignore 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

      public static final Ignore UNRECOGNIZED
  • Field Details

    • IGNORE_EMPTY

      public static final Ignore IGNORE_EMPTY
       Deprecated: Use IGNORE_IF_UNPOPULATED instead. TODO: Remove this value pre-v1.
       
      IGNORE_EMPTY = 1 [deprecated = true];
    • IGNORE_DEFAULT

      public static final Ignore 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_VALUE
       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;
      See Also:
    • IGNORE_IF_UNPOPULATED_VALUE

      public static final int IGNORE_IF_UNPOPULATED_VALUE
       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;
      See Also:
    • IGNORE_IF_DEFAULT_VALUE_VALUE

      public static final int IGNORE_IF_DEFAULT_VALUE_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;
      See Also:
    • IGNORE_ALWAYS_VALUE

      public static final int IGNORE_ALWAYS_VALUE
       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;
      See Also:
    • IGNORE_EMPTY_VALUE

      @Deprecated public static final int 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 public static final int 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

      public static Ignore[] 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

      public static Ignore valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getNumber

      public final int getNumber()
      Specified by:
      getNumber in interface com.google.protobuf.Internal.EnumLite
      Specified by:
      getNumber in interface com.google.protobuf.ProtocolMessageEnum
    • valueOf

      @Deprecated public static Ignore valueOf(int value)
      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 name
      NullPointerException - if the argument is null
    • forNumber

      public static Ignore forNumber(int value)
      Parameters:
      value - The numeric wire value of the corresponding enum entry.
      Returns:
      The enum associated with the given numeric wire value.
    • internalGetValueMap

      public static com.google.protobuf.Internal.EnumLiteMap<Ignore> internalGetValueMap()
    • getValueDescriptor

      public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor()
      Specified by:
      getValueDescriptor in interface com.google.protobuf.ProtocolMessageEnum
    • getDescriptorForType

      public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType()
      Specified by:
      getDescriptorForType in interface com.google.protobuf.ProtocolMessageEnum
    • getDescriptor

      public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor()
    • valueOf

      public static Ignore valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc)
      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 name
      NullPointerException - if the argument is null