Expand description
§Unbinder - JSON Schema Dereferencer
A high-performance JSON Schema dereferencer that resolves $ref
pointers,
making schemas self-contained by replacing references with their actual content.
§Features
- Fast: Written in Rust with performance optimizations
- No-std support: Can be used in embedded environments
- WebAssembly support: Compile to WASM for browser/Node.js usage
- Circular reference handling: Detects and handles circular references gracefully
- Zero-copy where possible: Minimizes memory allocations
§Quick Start
use unbinder::{dereference_schema, Options};
use serde_json::json;
let mut schema = json!({
"type": "object",
"properties": {
"name": { "$ref": "#/definitions/name" }
},
"definitions": {
"name": { "type": "string" }
}
});
dereference_schema(&mut schema, Options::default())?;
§Circular Reference Handling
use unbinder::{dereference_schema, Options};
use serde_json::json;
let mut schema = json!({
"definitions": {
"node": {
"type": "object",
"properties": {
"children": {
"type": "array",
"items": { "$ref": "#/definitions/node" }
}
}
}
}
});
let opts = Options {
resolve_external: false,
on_circular: Some(|path| eprintln!("Circular reference: {}", path)),
};
dereference_schema(&mut schema, opts)?;
Structs§
- Options
- Configuration options for the dereferencer.
Functions§
- count
- Counts the number of objects, arrays, and references in a JSON value.
- dereference_
schema - Dereferences all
$ref
pointers in a JSON Schema document.
Type Aliases§
- Error
- Error type for dereferencing operations.