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 0 | 0 | 0 |
| 0.13.1 | 0 | 0 | 0 | 0 | 0 |
| 0.13.0 | 0 | 0 | 0 | 0 | 0 |
| 0.12.2 | 0 | 0 | 0 | 0 | 0 |
| 0.12.1 | 0 | 0 | 0 | 0 | 0 |
| 0.12.0 | 0 | 0 | 0 | 0 | 0 |
| 0.11.0 | 0 | 0 | 0 | 0 | 0 |
| 0.10.0 | 0 | 0 | 0 | 0 | 0 |
| 0.9.1 | 0 | 0 | 0 | 0 | 0 |
| 0.9.0 | 0 | 0 | 0 | 0 | 0 |
| 0.8.3 | 0 | 0 | 0 | 0 | 0 |
| 0.8.2 | 0 | 0 | 0 | 0 | 0 |
| 0.8.1 | 0 | 0 | 0 | 0 | 0 |
| 0.8.0 | 0 | 0 | 0 | 0 | 0 |
| 0.7.0 | 0 | 0 | 0 | 0 | 0 |
| 0.6.1 | 0 | 0 | 0 | 0 | 0 |
| 0.6.0 | 0 | 0 | 0 | 0 | 0 |
| 0.5.0 | 0 | 0 | 0 | 0 | 0 |
| 0.4.3 | 0 | 0 | 0 | 0 | 0 |
| 0.4.2 | 0 | 0 | 0 | 0 | 0 |
| 0.4.1 | 0 | 0 | 0 | 0 | 0 |
| 0.4.0 | 0 | 0 | 0 | 0 | 0 |
| 0.3.1 | 0 | 0 | 0 | 0 | 0 |
| 0.3.0 | 0 | 0 | 0 | 0 | 0 |
| 0.2.0 | 0 | 0 | 0 | 0 | 0 |
| 0.1.0 | 0 | 0 | 0 | 0 | 0 |
0.45.0 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
MIT - MIT LicenseA high-performance JSON Schema validator for Rust.
use serde_json::json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let schema = json!({"maxLength": 5});
let instance = json!("foo");
// One-off validation
assert!(jsonschema::is_valid(&schema, &instance));
assert!(jsonschema::validate(&schema, &instance).is_ok());
// Build & reuse (faster)
let validator = jsonschema::validator_for(&schema)?;
// Fail on first error
assert!(validator.validate(&instance).is_ok());
// Iterate over errors
for error in validator.iter_errors(&instance) {
eprintln!("Error: {error}");
eprintln!("Location: {}", error.instance_path());
}
// Boolean result
assert!(validator.is_valid(&instance));
// Structured output (JSON Schema Output v1)
let evaluation = validator.evaluate(&instance);
for annotation in evaluation.iter_annotations() {
eprintln!(
"Annotation at {}: {:?}",
annotation.schema_location,
annotation.annotations.value()
);
}
Ok(())
}You also can use it from the command line via the jsonschema-cli crate.
$ jsonschema-cli schema.json -i instance.jsonSee more usage examples in the documentation.
⚠️ Upgrading from older versions? Check our Migration Guide for key changes.
The following drafts are supported:
You can check the current status on the Bowtie Report.
jsonschema outperforms other Rust JSON Schema validators in most scenarios:
valico and jsonschema_valid for complex schemasboon, and >5000x faster for recursive schemasFor detailed benchmarks, see our full performance comparison.
This crate requires Rust 1.83.0 or later.
By default, jsonschema uses aws-lc-rs as the TLS cryptography provider, which is the default one in reqwest.
You can opt into using ring as the TLS provider:
[dependencies]
jsonschema = {
version = "0.42",
default-features = false,
features = ["resolve-http", "resolve-file", "tls-ring"]
}NOTE: If both tls-aws-lc-rs and tls-ring features are enabled, aws-lc-rs takes precedence.
This library draws API design inspiration from the Python jsonschema package. We're grateful to the Python jsonschema maintainers and contributors for their pioneering work in JSON Schema validation.
If you have questions, need help, or want to suggest improvements, please use GitHub Discussions.
If you find jsonschema useful, please consider sponsoring its development.
We welcome contributions! Here's how you can help:
See CONTRIBUTING.md for more details.
Licensed under MIT License.