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 and Description |
|---|
IGNORE_ALWAYS
The validation rules of this field will be skipped and not evaluated.
|
IGNORE_IF_DEFAULT_VALUE
Validation is skipped if the field is unpopulated or if it is a nullable
field populated with its default value.
|
IGNORE_IF_UNPOPULATED
Validation is skipped if the field is unpopulated.
|
IGNORE_UNSPECIFIED
Validation is only skipped if it's an unpopulated nullable fields.
|
UNRECOGNIZED |
| Modifier and Type | Field and Description |
|---|---|
static int |
IGNORE_ALWAYS_VALUE
The validation rules of this field will be skipped and not evaluated.
|
static Ignore |
IGNORE_DEFAULT
Deprecated: Use IGNORE_IF_DEFAULT_VALUE.
|
static int |
IGNORE_DEFAULT_VALUE
Deprecated.
|
static Ignore |
IGNORE_EMPTY
Deprecated: Use IGNORE_IF_UNPOPULATED instead.
|
static int |
IGNORE_EMPTY_VALUE
Deprecated.
|
static 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.
|
static int |
IGNORE_IF_UNPOPULATED_VALUE
Validation is skipped if the field is unpopulated.
|
static int |
IGNORE_UNSPECIFIED_VALUE
Validation is only skipped if it's an unpopulated nullable fields.
|
| Modifier and Type | Method and Description |
|---|---|
static Ignore |
forNumber(int value) |
static com.google.protobuf.Descriptors.EnumDescriptor |
getDescriptor() |
com.google.protobuf.Descriptors.EnumDescriptor |
getDescriptorForType() |
int |
getNumber() |
com.google.protobuf.Descriptors.EnumValueDescriptor |
getValueDescriptor() |
static com.google.protobuf.Internal.EnumLiteMap<Ignore> |
internalGetValueMap() |
static Ignore |
valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) |
static Ignore |
valueOf(int value)
Deprecated.
Use
forNumber(int) instead. |
static Ignore |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Ignore[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
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;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;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;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;public static final Ignore UNRECOGNIZED
public static final Ignore IGNORE_EMPTY
Deprecated: Use IGNORE_IF_UNPOPULATED instead. TODO: Remove this value pre-v1.
IGNORE_EMPTY = 1 [deprecated = true];public static final Ignore IGNORE_DEFAULT
Deprecated: Use IGNORE_IF_DEFAULT_VALUE. TODO: Remove this value pre-v1.
IGNORE_DEFAULT = 2 [deprecated = true];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;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;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;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;@Deprecated public static final int IGNORE_EMPTY_VALUE
Deprecated: Use IGNORE_IF_UNPOPULATED instead. TODO: Remove this value pre-v1.
IGNORE_EMPTY = 1 [deprecated = true];@Deprecated public static final int IGNORE_DEFAULT_VALUE
Deprecated: Use IGNORE_IF_DEFAULT_VALUE. TODO: Remove this value pre-v1.
IGNORE_DEFAULT = 2 [deprecated = true];public static Ignore[] values()
for (Ignore c : Ignore.values()) System.out.println(c);
public static Ignore valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic final int getNumber()
getNumber in interface com.google.protobuf.Internal.EnumLitegetNumber in interface com.google.protobuf.ProtocolMessageEnum@Deprecated public static Ignore valueOf(int value)
forNumber(int) instead.value - The numeric wire value of the corresponding enum entry.public static Ignore forNumber(int value)
value - The numeric wire value of the corresponding enum entry.public static com.google.protobuf.Internal.EnumLiteMap<Ignore> internalGetValueMap()
public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor()
getValueDescriptor in interface com.google.protobuf.ProtocolMessageEnumpublic final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType()
getDescriptorForType in interface com.google.protobuf.ProtocolMessageEnumpublic static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor()
public static Ignore valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc)
Copyright © 2024. All rights reserved.