Semantic validation of structured data. Define rules in JSON, DSL, Schematron XML, or plain English. Paths use JSONPath (RFC 9535). Inspired by ISO Schematron.
cargo install scheck
# With JSON rules
scheck validate doc.json --rules checks.json
# With DSL rules
scheck validate doc.json --rules checks.scheck
# Select phase and output format
scheck validate doc.json --rules checks.json --phase full --format json
scheck check rules.scheck
use scheck::builder::*;
use scheck::{Severity, validate_json};
let schema = schema("example")
.pattern("p", |p| p
.rule("$", |r| r
.assert(exists("$.name"), "name required")
.assert_with(
matches("$.email", r"^.+@.+\..+$"),
"email format invalid",
Severity::Warning,
)
)
)
.build();
let report = validate_json(&schema, json_str)?;
let report = scheck::check_json(rules_json, doc_json)?;
let report = scheck::check(rules_dsl, doc_json)?;