Registry / serialization / jsonschema-rs

jsonschema-rs

JSON →
library0.52.0pypypi✓ verified 24d ago

jsonschema-rs is a high-performance JSON Schema validator for Python, backed by a Rust implementation. It provides fast validation of JSON data against JSON schemas according to various draft specifications. The library is actively maintained with frequent releases, often synchronized across its Python, Ruby, and Rust bindings.

pip install jsonschema-rs
INSTALL
IMPORT
SIG · JSONSCHEMA-RS
J
jsonschema-rs
serializationpythonv0.52.0
Install
1.9s avg
Import
48ms
Disk
28MB
Pass rate
9/ 10
Env Coverage9 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.52.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 1.9s
py 3.11
✓ —
✓ 1.8s
py 3.12
✓ —
✓ 1.7s
py 3.13
✓ —
✓ 1.7s
py 3.9
✕ build_error
✓ 2.3s
28MB installed
● package 28MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Draft202012Validator
from jsonschema_rs import Draft202012Validator
from jsonschema_rs import JSONSchema
Draft7Validator
from jsonschema_rs import Draft7Validator
from jsonschema_rs import JSONSchema
ValidationError
from jsonschema_rs import ValidationError
from jsonschema_rs import JSONSchema

This quickstart demonstrates how to define a JSON schema, load it, and use `jsonschema_rs.JSONSchema` to validate JSON instances. It shows both a valid and an invalid instance, demonstrating how `ValidationError` is raised for invalid data.

import jsonschema_rs import json schema_str = ''' { "type": "object", "properties": { "name": {"type": "string"}, "age": {"type": "integer", "minimum": 0} }, "required": ["name", "age"] } ''' instance_valid_str = ''' { "name": "Alice", "age": 30 } ''' instance_invalid_str = ''' { "name": "Bob", "age": -5 } ''' schema = json.loads(schema_str) instance_valid = json.loads(instance_valid_str) instance_invalid = json.loads(instance_invalid_str) validator = jsonschema_rs.JSONSchema.from_dict(schema) # Validate a valid instance try: validator.validate(instance_valid) print("Valid instance passed validation.") except jsonschema_rs.ValidationError as e: print(f"Valid instance failed validation unexpectedly: {e}") # Validate an invalid instance try: validator.validate(instance_invalid) print("Invalid instance passed validation unexpectedly.") except jsonschema_rs.ValidationError as e: print(f"Invalid instance caught validation error: {e.message}")
Debug
Known issues
gotchaThe `multipleOf` validation for negative numeric instances was incorrectly handled and fixed in version `0.45.1`. If your schemas or data relied on the previous incorrect behavior (e.g., negative numbers incorrectly passing `multipleOf` validation), your validations may now fail as per specification.
fix
Ensure your schemas and data adhere strictly to the JSON Schema specification for `multipleOf` on negative numbers. Review any tests that might have implicitly relied on the bug.
affects: 0.1.0 - 0.45.0
gotchaThe `duration` format keyword previously had incorrect handling for certain patterns (e.g., hours/seconds without minutes, years/days without months). This was fixed in version `0.45.1`. If your schema used `duration` format and your data relied on the incorrect parsing, validation might now fail.
fix
Verify that `duration` strings in your data strictly follow the ISO 8601 duration format as expected by the JSON Schema specification. Update data or schemas if necessary.
affects: 0.1.0 - 0.45.0
deprecatedFlat invocation of the CLI (`jsonschema schema.json -i ...`) was deprecated in favor of explicit subcommands (`jsonschema validate` and `jsonschema bundle`).
fix
Update your CLI scripts to use the new `jsonschema validate` or `jsonschema bundle` subcommands for clarity and future compatibility.
affects: >=0.45.0
gotchaThe `hostname` format validation behavior changed in version `0.44.1`. It now applies legacy RFC 1034 semantics in Draft 4/6 and keeps IDNA A-label validation in Draft 7+. This might affect validation results for `hostname` strings when using older schema drafts.
fix
Review `hostname` validation for schemas targeting Draft 4 or 6. Ensure your data conforms to the expected RFC 1034 semantics for these drafts, or consider updating to a newer draft if IDNA A-label validation is desired.
affects: >=0.44.1
Upgrade
Version history
0.52.0latest on PyPI · released Aug 26, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
1 hits · last 30 days
Resources