pub type ErrorIterator<'a> = Box<dyn Iterator<Item = ValidationError<'a>> + Sync + Send + 'a>;
Expand description

An iterator over instances of ValidationError that represent validation error for the input instance.

Examples

use jsonschema::JSONSchema;
use serde_json::json;

let schema = json!({"maxLength": 5});
let instance = json!("foo");
if let Ok(compiled) = JSONSchema::compile(&schema) {
    let result = compiled.validate(&instance);
    if let Err(errors) = result {
        for error in errors {
            println!("Validation error: {}", error)
        }
    }
}