pub struct Validator { /* private fields */ }Expand description
A compiled JSON Schema validator using the declared dialect.
Implementations§
Source§impl Validator
impl Validator
Sourcepub fn compile(schema: &Value) -> Result<Self, SchemaError>
pub fn compile(schema: &Value) -> Result<Self, SchemaError>
Compiles schema (draft-07 unless the schema declares another draft).
§Errors
Returns SchemaError::InvalidSchema
when the schema is not a valid JSON Schema.
Sourcepub fn issues(&self, value: &Value) -> ValidationIssues
pub fn issues(&self, value: &Value) -> ValidationIssues
Collects every violation of value against the schema.
Sourcepub fn validate(&self, value: &Value) -> Result<(), ValidationIssues>
pub fn validate(&self, value: &Value) -> Result<(), ValidationIssues>
Validates value, returning all issues on failure.
§Errors
Returns the collected ValidationIssues when value violates the
schema.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Validator
impl !UnwindSafe for Validator
impl Freeze for Validator
impl Send for Validator
impl Sync for Validator
impl Unpin for Validator
impl UnsafeUnpin for Validator
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