jsonschema

Function is_valid

Source
pub fn is_valid(schema: &Value, instance: &Value) -> bool
Expand description

Validate instance against schema and get a true if the instance is valid and false otherwise. Draft is detected automatically.

§Examples

use serde_json::json;

let schema = json!({"maxLength": 5});
let instance = json!("foo");
assert!(jsonschema::is_valid(&schema, &instance));

§Panics

This function panics if an invalid schema is passed.