pub struct ErrorEntry<'a> {
pub schema_location: &'a str,
pub absolute_keyword_location: Option<&'a Uri<String>>,
pub instance_location: &'a Location,
pub error: &'a ErrorDescription,
}Expand description
Entry describing errors emitted by a keyword during evaluation.
Error entries contain information about validation failures, including the locations in both the schema and instance where the error occurred.
§Examples
use serde_json::json;
let schema = json!({
"type": "object",
"required": ["name"],
"properties": {
"age": {"type": "number"}
}
});
let validator = jsonschema::validator_for(&schema)?;
let instance = json!({"name": "test", "age": "oops"});
let evaluation = validator.evaluate(&instance);
let entry = evaluation.iter_errors().next().unwrap();
assert_eq!(entry.schema_location, "/properties/age/type");
assert_eq!(entry.instance_location.as_str(), "/age");
assert_eq!(entry.error.to_string(), "\"oops\" is not of type \"number\"");Fields§
§schema_location: &'a strThe JSON Pointer to the schema keyword that produced the error.
absolute_keyword_location: Option<&'a Uri<String>>The absolute URI of the keyword location, if available.
instance_location: &'a LocationThe JSON Pointer to the instance location that failed validation.
error: &'a ErrorDescriptionThe error description.
Trait Implementations§
Source§impl<'a> Clone for ErrorEntry<'a>
impl<'a> Clone for ErrorEntry<'a>
Source§fn clone(&self) -> ErrorEntry<'a>
fn clone(&self) -> ErrorEntry<'a>
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<'a> Debug for ErrorEntry<'a>
impl<'a> Debug for ErrorEntry<'a>
impl<'a> Copy for ErrorEntry<'a>
Auto Trait Implementations§
impl<'a> Freeze for ErrorEntry<'a>
impl<'a> RefUnwindSafe for ErrorEntry<'a>
impl<'a> Send for ErrorEntry<'a>
impl<'a> Sync for ErrorEntry<'a>
impl<'a> Unpin for ErrorEntry<'a>
impl<'a> UnsafeUnpin for ErrorEntry<'a>
impl<'a> UnwindSafe for ErrorEntry<'a>
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