pub fn validate<'i>(
schema: &Value,
instance: &'i Value,
) -> Result<(), ValidationError<'i>>
Expand description
Validate instance
against schema
and return the first error if any. Draft is detected automatically.
§Examples
use serde_json::json;
let schema = json!({"maxLength": 5});
let instance = json!("foo");
assert!(jsonschema::validate(&schema, &instance).is_ok());
§Panics
This function panics if an invalid schema is passed.