scheck

Semantic validation of structured data. Define rules in JSON, DSL, Schematron XML, or plain English. Paths use JSONPath (RFC 9535). Inspired by ISO Schematron.

Example:
JSON
DSL
Schematron
Free-text
CLI Usage

Install

cargo install scheck

Validate

# 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

Check rule syntax

scheck check rules.scheck
Rust Library Usage

Builder API

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)?;

JSON rules

let report = scheck::check_json(rules_json, doc_json)?;

DSL rules

let report = scheck::check(rules_dsl, doc_json)?;