JsonSchemaValidationException class
The error ObjectMapper throws when JSON read into a class marked
@JsonSchemaSource does not fit its schema.
path is where the checked value is in the document being read (empty for the whole document); each violation's path is a JSON pointer inside that value. The message lists them all.
try {
mapper.readValue<Order>(json);
} on JsonSchemaValidationException catch (error) {
for (final violation in error.violations) {
print('${violation.path}: ${violation.message}');
}
}
Spring (Java): Spring has no counterpart.
- Inheritance
-
- Object
- JsonMappingException
- JsonSchemaValidationException
Constructors
-
JsonSchemaValidationException(List<
JsonSchemaViolation> violations, {required String location, String path = ''}) -
The
violationsof the schema atlocation, for the value atpath.
Properties
- cause → Object?
-
The underlying error, such as a
FormatExceptionfor invalid JSON or what a constructor threw;nullwhen there is none.finalinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- location → String
-
The
@JsonSchemaSourcelocation of the schema that failed.final - message → String
-
What went wrong, without the path.
finalinherited
- path → String
-
Where the problem is, such as
items[2].price; empty for the whole value.finalinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
violations
→ List<
JsonSchemaViolation> -
Every place where the value does not fit the schema.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited