pub struct SchemaValidator {}Expand description
Validates JSON values against a simplified JSON Schema.
Currently performs basic type checking. Future versions may use the
jsonschema crate for full draft-07 validation.
Implementations§
Source§impl SchemaValidator
impl SchemaValidator
Sourcepub fn validate(&self, args: &Value, schema: &Value) -> Result<()>
pub fn validate(&self, args: &Value, schema: &Value) -> Result<()>
Validates arguments against a JSON Schema.
§Arguments
args— The JSON value to validateschema— A JSON Schema object (currently only"type"is checked)
§Returns
Ok(()) if the value matches the schema.
§Errors
Returns Error::SchemaValidationFailed
if the value’s type does not match the schema’s "type" field.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SchemaValidator
impl RefUnwindSafe for SchemaValidator
impl Send for SchemaValidator
impl Sync for SchemaValidator
impl Unpin for SchemaValidator
impl UnsafeUnpin 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