public final class Violation extends com.google.protobuf.GeneratedMessageV3 implements ViolationOrBuilder
`Violation` represents a single instance where a validation rule, expressed
as a `Constraint`, was not met. It provides information about the field that
caused the violation, the specific constraint that wasn't fulfilled, and a
human-readable error message.
```json
{
"fieldPath": "bar",
"constraintId": "foo.bar",
"message": "bar must be greater than 0"
}
```
Protobuf type buf.validate.Violation| Modifier and Type | Class and Description |
|---|---|
static class |
Violation.Builder
`Violation` represents a single instance where a validation rule, expressed
as a `Constraint`, was not met.
|
com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>,BuilderT extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageT,BuilderT>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable, com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter| Modifier and Type | Field and Description |
|---|---|
static int |
CONSTRAINT_ID_FIELD_NUMBER |
static int |
FIELD_PATH_FIELD_NUMBER |
static int |
FOR_KEY_FIELD_NUMBER |
static int |
MESSAGE_FIELD_NUMBER |
| Modifier and Type | Method and Description |
|---|---|
String |
getConstraintId()
`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.
|
com.google.protobuf.ByteString |
getConstraintIdBytes()
`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.
|
static Violation |
getDefaultInstance() |
Violation |
getDefaultInstanceForType() |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
String |
getFieldPath()
`field_path` is a machine-readable identifier that points to the specific field that failed the validation.
|
com.google.protobuf.ByteString |
getFieldPathBytes()
`field_path` is a machine-readable identifier that points to the specific field that failed the validation.
|
boolean |
getForKey()
`for_key` indicates whether the violation was caused by a map key, rather than a value.
|
String |
getMessage()
`message` is a human-readable error message that describes the nature of the violation.
|
com.google.protobuf.ByteString |
getMessageBytes()
`message` is a human-readable error message that describes the nature of the violation.
|
com.google.protobuf.Parser<Violation> |
getParserForType() |
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
static Violation.Builder |
newBuilder() |
static Violation.Builder |
newBuilder(Violation prototype) |
Violation.Builder |
newBuilderForType() |
protected Violation.Builder |
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) |
protected Object |
newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused) |
static Violation |
parseDelimitedFrom(InputStream input) |
static Violation |
parseDelimitedFrom(InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Violation |
parseFrom(byte[] data) |
static Violation |
parseFrom(byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Violation |
parseFrom(ByteBuffer data) |
static Violation |
parseFrom(ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Violation |
parseFrom(com.google.protobuf.ByteString data) |
static Violation |
parseFrom(com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Violation |
parseFrom(com.google.protobuf.CodedInputStream input) |
static Violation |
parseFrom(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Violation |
parseFrom(InputStream input) |
static Violation |
parseFrom(InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static com.google.protobuf.Parser<Violation> |
parser() |
Violation.Builder |
toBuilder() |
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getSerializedSize, getUnknownFields, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, isInitialized, isStringEmpty, makeExtensionsImmutable, makeMutableCopy, makeMutableCopy, mergeFromAndMakeImmutableInternal, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBooleanList, newBuilderForType, newDoubleList, newFloatList, newIntList, newLongList, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTag, writeToequals, findInitializationErrors, getInitializationErrorString, hashBoolean, hashCode, hashEnum, hashEnumList, hashFields, hashLong, toStringaddAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final int FIELD_PATH_FIELD_NUMBER
public static final int CONSTRAINT_ID_FIELD_NUMBER
public static final int MESSAGE_FIELD_NUMBER
public static final int FOR_KEY_FIELD_NUMBER
protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
newInstance in class com.google.protobuf.GeneratedMessageV3public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3public String getFieldPath()
`field_path` is a machine-readable identifier that points to the specific field that failed the validation. This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation.
string field_path = 1 [json_name = "fieldPath"];getFieldPath in interface ViolationOrBuilderpublic com.google.protobuf.ByteString getFieldPathBytes()
`field_path` is a machine-readable identifier that points to the specific field that failed the validation. This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation.
string field_path = 1 [json_name = "fieldPath"];getFieldPathBytes in interface ViolationOrBuilderpublic String getConstraintId()
`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated.
string constraint_id = 2 [json_name = "constraintId"];getConstraintId in interface ViolationOrBuilderpublic com.google.protobuf.ByteString getConstraintIdBytes()
`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated.
string constraint_id = 2 [json_name = "constraintId"];getConstraintIdBytes in interface ViolationOrBuilderpublic String getMessage()
`message` is a human-readable error message that describes the nature of the violation. This can be the default error message from the violated `Constraint`, or it can be a custom message that gives more context about the violation.
string message = 3 [json_name = "message"];getMessage in interface ViolationOrBuilderpublic com.google.protobuf.ByteString getMessageBytes()
`message` is a human-readable error message that describes the nature of the violation. This can be the default error message from the violated `Constraint`, or it can be a custom message that gives more context about the violation.
string message = 3 [json_name = "message"];getMessageBytes in interface ViolationOrBuilderpublic boolean getForKey()
`for_key` indicates whether the violation was caused by a map key, rather than a value.
bool for_key = 4 [json_name = "forKey"];getForKey in interface ViolationOrBuilderpublic static Violation parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Violation parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Violation parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Violation parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Violation parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Violation parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Violation parseFrom(InputStream input) throws IOException
IOExceptionpublic static Violation parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static Violation parseDelimitedFrom(InputStream input) throws IOException
IOExceptionpublic static Violation parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static Violation parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
IOExceptionpublic static Violation parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic Violation.Builder newBuilderForType()
newBuilderForType in interface com.google.protobuf.MessagenewBuilderForType in interface com.google.protobuf.MessageLitepublic static Violation.Builder newBuilder()
public static Violation.Builder newBuilder(Violation prototype)
public Violation.Builder toBuilder()
toBuilder in interface com.google.protobuf.MessagetoBuilder in interface com.google.protobuf.MessageLiteprotected Violation.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
newBuilderForType in class com.google.protobuf.GeneratedMessageV3public static Violation getDefaultInstance()
public static com.google.protobuf.Parser<Violation> parser()
public com.google.protobuf.Parser<Violation> getParserForType()
getParserForType in interface com.google.protobuf.MessagegetParserForType in interface com.google.protobuf.MessageLitegetParserForType in class com.google.protobuf.GeneratedMessageV3public Violation getDefaultInstanceForType()
getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuildergetDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilderCopyright © 2023. All rights reserved.