pub struct ValidationError {
pub path: String,
pub expected: String,
pub found: String,
pub message: Option<String>,
pub error_type: String,
pub schema_info: Option<SchemaInfo>,
}Will be extracted to mockforge-contracts crate
Expand description
Enhanced validation error with detailed schema information
Fields§
§path: StringWill be extracted to mockforge-contracts crate
JSON path to the field with validation issue
expected: StringWill be extracted to mockforge-contracts crate
Expected schema constraint or value type
found: StringWill be extracted to mockforge-contracts crate
What was actually found in the request
message: Option<String>Will be extracted to mockforge-contracts crate
Human-readable error message explaining the validation failure
error_type: StringWill be extracted to mockforge-contracts crate
Error classification for client handling (e.g., “type_mismatch”, “required_missing”)
schema_info: Option<SchemaInfo>Will be extracted to mockforge-contracts crate
Additional context about the expected schema constraints
Implementations§
Source§impl ValidationError
impl ValidationError
Sourcepub fn new(
path: String,
expected: String,
found: String,
error_type: &str,
) -> Self
👎Deprecated: Will be extracted to mockforge-contracts crate
pub fn new( path: String, expected: String, found: String, error_type: &str, ) -> Self
Will be extracted to mockforge-contracts crate
Create a new validation error
§Arguments
path- JSON path to the field with validation issueexpected- Expected schema constraint or value typefound- What was actually found in the requesterror_type- Error classification (e.g., “type_mismatch”, “required_missing”)
Sourcepub fn with_message(self, message: String) -> Self
👎Deprecated: Will be extracted to mockforge-contracts crate
pub fn with_message(self, message: String) -> Self
Will be extracted to mockforge-contracts crate
Add a human-readable error message
Sourcepub fn with_schema_info(self, schema_info: SchemaInfo) -> Self
👎Deprecated: Will be extracted to mockforge-contracts crate
pub fn with_schema_info(self, schema_info: SchemaInfo) -> Self
Will be extracted to mockforge-contracts crate
Add detailed schema constraint information
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 moreSource§impl Debug for ValidationError
impl Debug for ValidationError
Source§impl<'de> Deserialize<'de> for ValidationError
impl<'de> Deserialize<'de> for ValidationError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<ValidationError> for FieldError
impl From<ValidationError> for FieldError
Source§fn from(error: ValidationError) -> Self
fn from(error: ValidationError) -> Self
Auto Trait Implementations§
impl Freeze for ValidationError
impl RefUnwindSafe for ValidationError
impl Send for ValidationError
impl Sync for ValidationError
impl Unpin for ValidationError
impl UnsafeUnpin for ValidationError
impl UnwindSafe for ValidationError
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
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>
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>
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