json_schema_ast

Crates.iojson_schema_ast
lib.rsjson_schema_ast
version0.2.2
created_at2025-04-20 07:30:30.622795+00
updated_at2025-09-23 03:52:59.540573+00
descriptionJSON Schema Compatibility Checker
homepage
repositoryhttps://github.com/ostrowr/jsoncompat
max_upload_size
id1641467
size76,529
Robbie Ostrow (ostrowr)

documentation

README

json_schema_ast

JSON Schema AST and reference resolver.

crates.io docs.rs License: MIT

Installation

Add to your Cargo.toml:

[dependencies]
json_schema_ast = "0.2.1"

Usage

use json_schema_ast::{build_and_resolve_schema, compile, SchemaNode, JSONSchema};
use serde_json::json;

let raw = json!({
    "type": "object",
    "properties": {
        "id": { "type": "integer" },
        "name": { "type": "string" }
    },
    "required": ["id"]
});

// Build AST
let schema_node: SchemaNode = build_and_resolve_schema(&raw).unwrap();

// Compile a fast validator
let validator: JSONSchema = compile(&raw).unwrap();

// Validate instances
assert!(validator.is_valid(&json!({ "id": 42 })));

License

Licensed under MIT. See LICENSE.

Commit count: 28

cargo fmt