pub struct SchemaValidator { /* private fields */ }Expand description
Schema validator that compiles and validates JSON Schema
Implementations§
Source§impl SchemaValidator
impl SchemaValidator
Sourcepub fn new(schema: Value) -> Result<Self, String>
pub fn new(schema: Value) -> Result<Self, String>
Create a new validator from a JSON Schema
§Errors
Returns an error if the schema is invalid or compilation fails.
Sourcepub fn validate_json(&self, json_bytes: &[u8]) -> Result<Value, ValidationError>
pub fn validate_json(&self, json_bytes: &[u8]) -> Result<Value, ValidationError>
Validate and parse JSON bytes
§Errors
Returns a validation error if the JSON is invalid or fails validation against the schema.
Trait Implementations§
Source§impl Clone for SchemaValidator
impl Clone for SchemaValidator
Source§fn clone(&self) -> SchemaValidator
fn clone(&self) -> SchemaValidator
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 moreAuto Trait Implementations§
impl Freeze for SchemaValidator
impl !RefUnwindSafe for SchemaValidator
impl Send for SchemaValidator
impl Sync for SchemaValidator
impl Unpin for SchemaValidator
impl !UnwindSafe for SchemaValidator
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