pub enum ValidationError {
Show 22 variants
InvalidRef {
instance_path: JsonPointer,
ref_str: String,
reason: String,
},
ExpectedObject {
instance_path: JsonPointer,
got: String,
},
ExpectedString {
instance_path: JsonPointer,
got: String,
},
ExpectedInteger {
instance_path: JsonPointer,
got: String,
},
ExpectedNumber {
instance_path: JsonPointer,
got: String,
},
ExpectedArray {
instance_path: JsonPointer,
got: String,
},
ExpectedBoolean {
instance_path: JsonPointer,
got: String,
},
DuplicateArrayItems {
instance_path: JsonPointer,
duplicate_value: String,
},
TooFewItems {
instance_path: JsonPointer,
min_items: u64,
actual_count: u64,
},
TooManyItems {
instance_path: JsonPointer,
max_items: u64,
actual_count: u64,
},
MissingRequired {
instance_path: JsonPointer,
property: String,
},
DisallowedAdditionalProperty {
instance_path: JsonPointer,
property: String,
},
NotInEnum {
instance_path: JsonPointer,
invalid_value: String,
allowed: Vec<String>,
},
NotConst {
instance_path: JsonPointer,
expected: String,
actual: String,
},
BelowMinimum {
instance_path: JsonPointer,
minimum: OrderedF64,
actual: OrderedF64,
},
AboveMaximum {
instance_path: JsonPointer,
maximum: OrderedF64,
actual: OrderedF64,
},
TooShort {
instance_path: JsonPointer,
min_length: u64,
actual_length: u64,
},
TooLong {
instance_path: JsonPointer,
max_length: u64,
actual_length: u64,
},
PatternMismatch {
instance_path: JsonPointer,
pattern: String,
value: String,
},
InvalidPatternInSchema {
instance_path: JsonPointer,
pattern: String,
},
NoSubschemaMatched {
instance_path: JsonPointer,
subschema_count: usize,
},
MultipleSubschemasMatched {
instance_path: JsonPointer,
subschema_count: usize,
match_count: usize,
},
}Expand description
A single validation failure: kind and instance location.
Variants§
InvalidRef
Schema had an invalid or unsupported $ref, or the reference could not be resolved.
Fields
instance_path: JsonPointerJSON Pointer to the instance location where the referenced schema was applied.
ExpectedObject
Schema had type: "object" but the instance was not an object.
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
ExpectedString
Schema had type: "string" but the instance was not a string.
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
ExpectedInteger
Schema had type: "integer" but the instance was not an integer (e.g. float, string, or non-number).
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
ExpectedNumber
Schema had type: "number" but the instance was not a number (e.g. string, null, or non-number).
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
ExpectedArray
Schema had type: "array" but the instance was not an array.
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
ExpectedBoolean
Schema had type: "boolean" but the instance was not a boolean.
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
DuplicateArrayItems
Schema had uniqueItems: true but the array contained duplicate elements.
Fields
instance_path: JsonPointerJSON Pointer to the array instance that failed.
TooFewItems
Schema had minItems but the array had fewer elements.
Fields
instance_path: JsonPointerJSON Pointer to the array instance that failed.
TooManyItems
Schema had maxItems but the array had more elements.
Fields
instance_path: JsonPointerJSON Pointer to the array instance that failed.
MissingRequired
A property listed in required was absent.
Fields
instance_path: JsonPointerJSON Pointer to the object (parent of the missing property).
DisallowedAdditionalProperty
Schema had additionalProperties: false but the instance contained a property not in properties.
Fields
instance_path: JsonPointerJSON Pointer to the instance (the additional property).
NotInEnum
Schema had enum but the instance value was not one of the allowed values.
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
NotConst
Schema had const but the instance value was not equal to the const value.
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
BelowMinimum
Instance was below the schema’s minimum (inclusive lower bound).
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
minimum: OrderedF64The schema’s minimum value.
actual: OrderedF64Actual instance value (for user-facing context).
AboveMaximum
Instance was above the schema’s maximum (inclusive upper bound).
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
maximum: OrderedF64The schema’s maximum value.
actual: OrderedF64Actual instance value (for user-facing context).
TooShort
Schema had minLength but the string had fewer Unicode code points.
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
TooLong
Schema had maxLength but the string had more Unicode code points.
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
PatternMismatch
Schema had pattern but the string did not match the ECMA 262 regex.
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
InvalidPatternInSchema
Schema had an invalid pattern (not a valid ECMA 262 regex); compilation failed.
Fields
instance_path: JsonPointerJSON Pointer to the instance (schema location where pattern was applied).
NoSubschemaMatched
Schema had anyOf but the instance did not validate against any of the subschemas.
Fields
instance_path: JsonPointerJSON Pointer to the instance that failed.
MultipleSubschemasMatched
Schema had oneOf but the instance validated against more than one subschema.
Implementations§
Source§impl ValidationError
impl ValidationError
pub fn instance_path(&self) -> &JsonPointer
Trait Implementations§
Source§impl Clone for ValidationError
impl Clone for ValidationError
Source§fn clone(&self) -> ValidationError
fn clone(&self) -> ValidationError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more