Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

jsonschema-rs

Latest version: v0.63.2

Overview

Last scanned
26 Nov 2026
Published
26 Nov 2026
PyPI package Publisher: Stranger6667
838 Stars
143 Forks
12 Versions
9.9M Downloads
Rust Repo language

Scan summary

jsonschema-rs was last scanned on 26 Nov 2026 at version 0.63.2. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 12 versions; the latest 4 were published within 6 days (21–26 Nov 2026).
  • Findings: No rules fired in version 0.63.2.
  • Downloads: 9,881,254 downloads.

Versions

12 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.63.2 LATEST 26 Nov 2026 No rules fired
0.63.1 23 Nov 2026 No rules fired
0.63.0 22 Nov 2026 No rules fired
0.62.0 21 Nov 2026 Not shown
0.61.2 12 Nov 2026 Not shown

No rules fired in 0.63.2

Findings

Findings for v0.63.2. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.63.2; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

jsonschema-rs

Build Version Python versions License

A high-performance JSON Schema validator for Python.

import jsonschema_rs

schema = {"maxLength": 5}
instance = "foo"

# One-off validation
try:
    jsonschema_rs.validate(schema, "incorrect")
except jsonschema_rs.ValidationError as exc:
    assert str(exc) == '''"incorrect" is longer than 5 characters

Failed validating "maxLength" in schema

On instance:
    "incorrect"'''

# Build & reuse (faster)
validator = jsonschema_rs.validator_for(schema)

# Iterate over errors
for error in validator.iter_errors(instance):
    print(f"Error: {error}")
    print(f"Location: {error.instance_path}")

# Boolean result
assert validator.is_valid(instance)

# Structured output (JSON Schema Output v1)
evaluation = validator.evaluate(instance)
for error in evaluation.errors():
    print(f"Error at {error['instanceLocation']}: {error['error']}")

⚠️ Upgrading from older versions? See the Migration Guide for breaking changes.

Migrating from jsonschema? See the jsonschema migration guide.

Highlights

  • 📚 Drafts 4, 6, 7, 2019-09 and 2020-12
  • 🔧 Custom keywords and format validators
  • ⚡ Compile-time validators for your own extension modules, via the Rust crate
  • 🌐 $ref resolution over HTTP and from files
  • 📦 Schema bundling into Compound Schema Documents, and $ref dereferencing
  • 🎨 Structured Output v1 reports (flag/list/hierarchical)
  • ✨ Meta-schema validation for schema documents, including custom metaschemas
  • 🧮 Experimental schema canonicalization
Supported drafts
  • Draft 2020-12
  • Draft 2019-09
  • Draft 7
  • Draft 6
  • Draft 4

Per-draft compliance results are on the Bowtie Report.

Playground

Try schemas in the browser with the WebAssembly playground.

Installation

pip install jsonschema-rs

Usage

Pass a schema as a JSON string to skip parsing it in Python:

import jsonschema_rs

validator = jsonschema_rs.validator_for('{"minimum": 42}')
...

validator_for detects the draft from $schema. To pick one yourself, use a draft-specific class:

import jsonschema_rs

# Automatic draft detection
validator = jsonschema_rs.validator_for({"minimum": 42})

# Draft-specific validators
validator = jsonschema_rs.Draft4Validator({"minimum": 42})
validator = jsonschema_rs.Draft6Validator({"minimum": 42})
validator = jsonschema_rs.Draft7Validator({"minimum": 42})
validator = jsonschema_rs.Draft201909Validator({"minimum": 42})
validator = jsonschema_rs.Draft202012Validator({"minimum": 42})

With a chosen draft (a draft-specific class or draft=), the $schema URI is not retrieved: pass a custom meta-schema in registry= so its $vocabulary applies.

jsonschema-rs ships validators for the standard format values. To add your own, pass a function that takes a str and returns a bool via formats. Drafts 2019-09 and 2020-12 treat format as an annotation, so set validate_formats=True to get it checked:

import jsonschema_rs

def is_currency(value):
    # The input value is always a string
    return len(value) == 3 and value.isascii()


validator = jsonschema_rs.validator_for(
    {"type": "string", "format": "currency"}, 
    formats={"currency": is_currency},
    validate_formats=True  # Important for Draft 2019-09 and 2020-12
)
validator.is_valid("USD")  # True
validator.is_valid("invalid")  # False

To check numbers, wrap the function in number_format; it receives an int, float or Decimal:

is_int32 = jsonschema_rs.number_format(lambda number: -(2**31) <= number < 2**31)
validator = jsonschema_rs.validator_for(
    {"format": "int32"}, formats={"int32": is_int32}, validate_formats=True
)
assert not validator.is_valid(2**31)

known_formats lists the formats with a check under a draft, built in and from formats:

names = jsonschema_rs.known_formats(jsonschema_rs.Draft202012, formats={"currency": is_currency})
assert "uuid" in names and "currency" in names
Validating JSON Text

When instances arrive as JSON text, such as request bodies or queue messages, JsonTextValidator validates the str or bytes directly, without building Python objects for them. On the benchmark documents this is 2.5-9.9x faster than json.loads followed by is_valid, and 1.3-2.3x faster than orjson.loads followed by is_valid. It takes the same arguments as validator_for, plus draft:

import jsonschema_rs

validator = jsonschema_rs.JsonTextValidator({"type": "object", "required": ["id"]})
validator.is_valid('{"id": 1}')  # True
validator.is_valid(b'{"name": "x"}')  # False

Text that is not a single JSON document raises ValueError, and a repeated key keeps its last value, as with json.loads. Unlike json.loads, it also raises for NaN and Infinity, which are not JSON, and for documents nested 128 levels deep or more. Custom keywords receive the instance as Python objects.

Custom Keywords

A custom keyword is a class. The validator builds one instance per occurrence of the keyword, passing the parent schema, the keyword value and its schema path. Its validate method rejects a value by raising any exception, whose message becomes the error message:

import jsonschema_rs

class DivisibleBy:
    def __init__(self, parent_schema, value, schema_path):
        self.divisor = value

    def validate(self, instance):
        if isinstance(instance, int) and instance % self.divisor != 0:
            raise ValueError(f"{instance} is not divisible by {self.divisor}")


validator = jsonschema_rs.validator_for(
    {"type": "integer", "divisibleBy": 3},
    keywords={"divisibleBy": DivisibleBy},
)
validator.is_valid(9)   # True
validator.is_valid(10)  # False

The resulting ValidationError keeps that exception as __cause__:

try:
    validator.validate(10)
except jsonschema_rs.ValidationError as e:
    print(type(e.__cause__))   # <class 'ValueError'>
    print(e.__cause__)         # original message

Other options:

  • validate_formats: check format regardless of the draft default.
  • ignore_unknown_formats: set to False to raise on a format value with no validator.
  • base_uri: base URI for relative $refs in the schema.
  • vocabularies: vocabularies your custom keywords implement.
import jsonschema_rs

validator = jsonschema_rs.Draft202012Validator(
    {"type": "string", "format": "date"},
    validate_formats=True,
    ignore_unknown_formats=False
)

# This will validate the "date" format
validator.is_valid("2023-05-17")  # True
validator.is_valid("not a date")  # False

# With ignore_unknown_formats=False, an unknown format raises an error
invalid_schema = {"type": "string", "format": "unknown"}
try:
    jsonschema_rs.Draft202012Validator(
        invalid_schema, validate_formats=True, ignore_unknown_formats=False
    )
except jsonschema_rs.ValidationError as exc:
    assert exc.message == (
        "Unknown format: 'unknown'. "
        "Adjust configuration to ignore unrecognized formats"
    )
Structured Output with evaluate

evaluate returns the JSON Schema Output v1 formats instead of a boolean:

import jsonschema_rs

schema = {
    "type": "array",
    "prefixItems": [{"type": "string"}],
    "items": {"type": "integer"},
}
evaluation = jsonschema_rs.evaluate(schema, ["hello", "oops"])
type_error = {"type": '"oops" is not of type "integer"'}

assert evaluation.flag() == {"valid": False}
assert evaluation.list() == {
    "valid": False,
    "details": [
        {
            "evaluationPath": "",
            "instanceLocation": "",
            "schemaLocation": "",
            "valid": False,
        },
        {
            "valid": True,
            "evaluationPath": "/type",
            "instanceLocation": "",
            "schemaLocation": "/type",
        },
        {
            "valid": False,
            "evaluationPath": "/items",
            "instanceLocation": "",
            "schemaLocation": "/items",
            "droppedAnnotations": True,
        },
        {
            "valid": False,
            "evaluationPath": "/items",
            "instanceLocation": "/1",
            "schemaLocation": "/items",
        },
        {
            "valid": False,
            "evaluationPath": "/items/type",
            "instanceLocation": "/1",
            "schemaLocation": "/items/type",
            "errors": type_error,
        },
        {
            "valid": True,
            "evaluationPath": "/prefixItems",
            "instanceLocation": "",
            "schemaLocation": "/prefixItems",
            "annotations": 0,
        },
        {
            "valid": True,
            "evaluationPath": "/prefixItems/0",
            "instanceLocation": "/0",
            "schemaLocation": "/prefixItems/0",
        },
        {
            "valid": True,
            "evaluationPath": "/prefixItems/0/type",
            "instanceLocation": "/0",
            "schemaLocation": "/prefixItems/0/type",
        },
    ],
}

hierarchical = evaluation.hierarchical()
assert hierarchical == {
    "valid": False,
    "evaluationPath": "",
    "instanceLocation": "",
    "schemaLocation": "",
    "details": [
        {
            "valid": True,
            "evaluationPath": "/type",
            "instanceLocation": "",
            "schemaLocation": "/type",
        },
        {
            "valid": False,
            "evaluationPath": "/items",
            "instanceLocation": "",
            "schemaLocation": "/items",
            "droppedAnnotations": True,
            "details": [
                {
                    "valid": False,
                    "evaluationPath": "/items",
                    "instanceLocation": "/1",
                    "schemaLocation": "/items",
                    "details": [
                        {
                            "valid": False,
                            "evaluationPath": "/items/type",
                            "instanceLocation": "/1",
                            "schemaLocation": "/items/type",
                            "errors": type_error,
                        }
                    ],
                }
            ],
        },
        {
            "valid": True,
            "evaluationPath": "/prefixItems",
            "instanceLocation": "",
            "schemaLocation": "/prefixItems",
            "annotations": 0,
            "details": [
                {
                    "valid": True,
                    "evaluationPath": "/prefixItems/0",
                    "instanceLocation": "/0",
                    "schemaLocation": "/prefixItems/0",
                    "details": [
                        {
                            "valid": True,
                            "evaluationPath": "/prefixItems/0/type",
                            "instanceLocation": "/0",
                            "schemaLocation": "/prefixItems/0/type",
                        }
                    ],
                }
            ],
        },
    ],
}

assert evaluation.errors() == [
    {
        "schemaLocation": "/items/type",
        "absoluteKeywordLocation": None,
        "instanceLocation": "/1",
        "error": '"oops" is not of type "integer"',
    }
]

# A failing schema produces no annotations
assert evaluation.annotations() == []
Arbitrary-Precision Numbers

Numbers keep their full precision on the way to Python:

  • Integers, regardless of size, are returned as regular int objects.
  • Floating-point literals that fit into IEEE-754 become Python floats.
  • Floating-point literals that don't fit in float (for example 1e10000 or extremely precise decimals) fall back to decimal.Decimal using their original JSON string representation.

So ValidationError.kind attributes can hold Decimal values:

from decimal import Decimal
from jsonschema_rs import ValidationError, validator_for

validator = validator_for('{"const": 1e10000}')
try:
    validator.validate(0)
except ValidationError as exc:
    assert exc.kind.expected_value == Decimal("1e10000")

Schema Bundling and Dereferencing

Produce a Compound Schema Document (Appendix B) by embedding all external $ref targets into a draft-appropriate container. The bundle accepts the same values as the original.

import jsonschema_rs

address_schema = {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://example.com/address.json",
    "type": "object",
    "properties": {"street": {"type": "string"}, "city": {"type": "string"}},
    "required": ["street", "city"]
}

schema = {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {"home": {"$ref": "https://example.com/address.json"}},
    "required": ["home"]
}

registry = jsonschema_rs.Registry(
    [("https://example.com/address.json", address_schema)]
)
bundled = jsonschema_rs.bundle(schema, registry=registry)

dereference instead replaces each $ref with the schema it points to, for consumers that do not resolve references. Circular references are left in place.

dereferenced = jsonschema_rs.dereference(schema, registry=registry)

Schema Canonicalization

Experimental: the canonicalization API may change in minor releases.

canonicalize reduces a schema to a normal form that accepts the same values. Many schemas that accept the same values reduce to equal CanonicalSchema objects, and a schema proven to accept nothing reduces to false:

import jsonschema_rs

canonical = jsonschema_rs.canonicalize({
    "allOf": [
        {"type": "integer", "minimum": 0},
        {"minimum": 10, "maximum": 100},
    ]
})
assert canonical.to_json_schema() == {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "integer", "minimum": 10, "maximum": 100,
}

# These two accept the same values and compare equal
same = jsonschema_rs.canonicalize(
    {"type": "integer", "maximum": 100, "minimum": 10}
)
assert canonical == same

# A schema no value can satisfy collapses
from jsonschema_rs.canonical import Satisfiability

empty = jsonschema_rs.canonicalize(
    {"type": "integer", "minimum": 10, "maximum": 5}
)
assert empty.satisfiability() == Satisfiability.NO

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases jsonschema-rs

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

PolinRider Returns
Research

PolinRider Returns: Hijacked npm Packages Use Ethereum Blockchain to Conceal Malware Infrastructure

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

Vulnerability Insights

OpenSSH Password Authentication Bypass on Alpine Linux (*sshole) – CVE-2026-123158

Frame 2085668439 (1)
Group 1261154229