jsonschema
A high-performance JSON Schema validator for Rust with Python, Ruby, and WASM bindings
Repository Health
Technical Analysis
jsonschema is a Rust crate for validating JSON documents against JSON Schema, supporting Draft 4, 6, 7, 2019-09, and 2020-12. It compiles a schema into a reusable Validator that can be run repeatedly against many instances, and also ships a #[jsonschema::validator] macro that generates a specialized validator at compile time for schemas known ahead of time, avoiding runtime compilation entirely for a further 3-13x speedup over the already-fast runtime path.
Beyond the core Rust API, the project is a monorepo of bindings and tools built on the same validation engine: a Python package (jsonschema-rs), a Ruby gem, a WebAssembly build with a hosted playground, and a standalone CLI crate. It supports custom keywords and format validators, blocking and non-blocking remote $ref resolution over network or file, and Structured Output v1 reports (flag/list/hierarchical), making it usable both as an embedded validation library and as a general-purpose schema-checking tool.
What You Get
- A
Validatortype built once from a schema (validator_for) and reused across manyvalidate/is_valid/iter_errorscalls - A
#[jsonschema::validator]macro (via themacrosfeature) that generates a specialized, compile-time validator from an inline or file-based schema - Support for Draft 4, 6, 7, 2019-09, and 2020-12, with custom keyword and format validator hooks
- Blocking and non-blocking remote reference resolution over network or filesystem
- Structured Output v1 reports (flag/list/hierarchical) via the
evaluate/iter_annotationsAPI - Official Python, Ruby, and WebAssembly bindings plus a standalone
jsonschema-clicrate, all built on the same core crate
Common Use Cases
- Validating configuration files (e.g. Tauri or Apollo Router-style config validation) against a JSON Schema at startup
- Validating API request/response payloads in a Rust web service before further processing
- Using the compile-time
#[jsonschema::validator]macro to eliminate runtime schema-compilation overhead in hot paths - Validating CSV or tabular records against a schema with custom keyword validators (as used by the
qsvCLI) - Running ad-hoc schema validation from the command line via the
jsonschema-clicrate without writing any Rust code
Under The Hood
Architecture - The workspace (Cargo.toml, members = ["crates/*"]) splits the core validation engine (crates/jsonschema) from jsonschema-referencing (reference resolution), jsonschema-regex, the proc-macro implementation (jsonschema-macros/jsonschema-macros-core), and per-language bindings (jsonschema-py, jsonschema-rb, jsonschema-wasm) plus jsonschema-cli. Each binding crate wraps the same core Validator rather than reimplementing validation logic, so drafts and keywords stay consistent across languages.
Tech Stack - Pure Rust (88.7% of the codebase) on top of serde/serde_json, with ahash for hashing; the crate’s default TLS provider is aws-lc-rs with an opt-in tls-ring feature for remote $ref fetching. MSRV is pinned at Rust 1.85.0, and workspace-wide Clippy pedantic lints are enabled with unsafe_code and unreachable_pub set to warn.
Code Quality - A dedicated jsonschema-testsuite crate plus jsonschema-testsuite-codegen generates tests from the official JSON Schema test suite, and a companion benchmark-suite crate tracks performance against valico, jsonschema_valid, and boon. Codecov is wired into CI, and the project publishes live spec-compliance results per draft via the Bowtie report.
API Design - The primary API is deliberately small: is_valid/validate for one-off checks, validator_for to build a reusable Validator, and iter_errors/evaluate for detailed or structured-output reporting. The optional #[jsonschema::validator] macro lets a schema known at compile time skip runtime compilation entirely while keeping the same is_valid/validate call shape, which the maintainers acknowledge was directly inspired by the Python jsonschema package’s API.
Used by 6 apps in this directory
AFFiNE
Productivity · Project Management · Note Taking
Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.
Cog
AI Development · Devops · Developer Tools
An open-source CLI that packages machine learning models into standard, production-ready Docker containers — no Dockerfile wrangling, no CUDA version hell.
iii
Developer Tools · Devops
Compose, extend, and observe every backend service in real time using three primitives: Workers, Functions, and Triggers.
Spacedrive
File Storage · Collaboration
One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.
Svix
Developer Tools · Automation
Open source, self-hostable webhook infrastructure that handles delivery, retries, HMAC signing, and multi-tenant event management so you never have to build a webhooks system from scratch.
Terrateam
Devops · Developer Tools
GitOps automation for Terraform, Pulumi, and IaC at scale