| Crates.io | json_schema_ast |
| lib.rs | json_schema_ast |
| version | 0.2.2 |
| created_at | 2025-04-20 07:30:30.622795+00 |
| updated_at | 2025-09-23 03:52:59.540573+00 |
| description | JSON Schema Compatibility Checker |
| homepage | |
| repository | https://github.com/ostrowr/jsoncompat |
| max_upload_size | |
| id | 1641467 |
| size | 76,529 |
JSON Schema AST and reference resolver.
Add to your Cargo.toml:
[dependencies]
json_schema_ast = "0.2.1"
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 })));
Licensed under MIT. See LICENSE.