pub enum SchemaValidationError {
TypeMismatch {
path: String,
expected: String,
actual: String,
},
MissingRequired {
path: String,
field: String,
},
OutOfRange {
path: String,
value: String,
min: String,
max: String,
},
StringLengthConstraint {
path: String,
actual: usize,
min: usize,
max: usize,
},
PatternMismatch {
path: String,
value: String,
pattern: String,
},
ArraySizeConstraint {
path: String,
actual: usize,
min: usize,
max: usize,
},
DuplicateItems {
path: String,
},
InvalidEnumValue {
path: String,
value: String,
},
AdditionalPropertyNotAllowed {
path: String,
property: String,
},
NoMatchingOneOf {
path: String,
},
AllOfFailure {
path: String,
failures: String,
},
}Expand description
Schema validation error with detailed context
Provides rich error information including the JSON path where validation failed, expected vs actual values, and human-readable error messages.
§Design
- Includes full path context for nested validation failures
- Provides actionable error messages for debugging
- Zero-allocation for common error cases using
String
Variants§
TypeMismatch
Type mismatch error
Fields
MissingRequired
Missing required field
OutOfRange
Value out of range
Fields
StringLengthConstraint
String length constraint violation
Fields
PatternMismatch
Pattern mismatch
Fields
ArraySizeConstraint
Array size constraint violation
Fields
DuplicateItems
Unique items constraint violation
InvalidEnumValue
Invalid enum value
AdditionalPropertyNotAllowed
Additional properties not allowed
NoMatchingOneOf
No matching schema in OneOf
AllOfFailure
Not all schemas match in AllOf
Trait Implementations§
Source§impl Clone for SchemaValidationError
impl Clone for SchemaValidationError
Source§fn clone(&self) -> SchemaValidationError
fn clone(&self) -> SchemaValidationError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SchemaValidationError
impl Debug for SchemaValidationError
Source§impl<'de> Deserialize<'de> for SchemaValidationError
impl<'de> Deserialize<'de> for SchemaValidationError
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchemaValidationError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchemaValidationError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for SchemaValidationError
impl Display for SchemaValidationError
Source§impl Error for SchemaValidationError
impl Error for SchemaValidationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<&SchemaValidationError> for ValidationErrorDto
impl From<&SchemaValidationError> for ValidationErrorDto
Source§fn from(error: &SchemaValidationError) -> Self
fn from(error: &SchemaValidationError) -> Self
Converts to this type from the input type.
Source§impl From<DomainError> for SchemaValidationError
impl From<DomainError> for SchemaValidationError
Source§fn from(error: DomainError) -> SchemaValidationError
fn from(error: DomainError) -> SchemaValidationError
Converts to this type from the input type.
Source§impl PartialEq for SchemaValidationError
impl PartialEq for SchemaValidationError
Source§impl Serialize for SchemaValidationError
impl Serialize for SchemaValidationError
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for SchemaValidationError
Auto Trait Implementations§
impl Freeze for SchemaValidationError
impl RefUnwindSafe for SchemaValidationError
impl Send for SchemaValidationError
impl Sync for SchemaValidationError
impl Unpin for SchemaValidationError
impl UnwindSafe for SchemaValidationError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more