jsonschema-typed-v2
Automatic type annotations from JSON schemas
What it is and what it does
jsonschema-typed-v2 bridges JSON Schema and Python's type system by converting JSON Schema definitions into TypedDict annotations that mypy can understand. When you annotate a variable with JSONSchema["path/to/schema.json"], the package's mypy plugin intercepts the type and generates a TypedDict matching the schema's structure—translating JSON types (string, number, boolean, array, object) into Python equivalents and marking required vs. optional fields. This lets you catch type errors in JSON-shaped data at static-check time rather than runtime.
The package is a maintained fork of an earlier abandoned project. It depends on jsonschema for schema parsing and mypy for the plugin infrastructure. Most JSON Schema concepts map straightforwardly to Python types, though some (like additionalProperties and self-references) have known limitations. Configuration requires enabling the plugin in mypy.ini and disabling mypy's cache due to how type hints are generated.
Use it for:
- Validate API request/response payloads against a JSON Schema while getting IDE autocomplete and type errors during development.
- Ensure configuration files loaded from JSON match an expected schema without writing manual TypedDict classes.
- Catch typos in JSON object keys and type mismatches in data pipelines before runtime.
- Generate type stubs for dynamically loaded JSON data in data processing or ETL workflows.
- Enforce schema compliance in test fixtures and mock data without duplicating type definitions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates Python TypedDict type annotations automatically from JSON Schema definitions, enabling static type checking of JSON data structures through mypy.
Yes, if you actively use JSON Schema and want static type checking without manually writing TypedDict classes. The low install friction and permissive license make adoption easy. However, maintenance is dormant (last release 2020-08-11), and the package depends on mypy's unstable plugin API—newer mypy versions may break it without warning. Suitable for stable projects where you control mypy versions; risky for codebases that auto-upgrade dependencies.
Install
jsonschema-typed-v2 on PyPI
pip
pip install jsonschema-typed-v2uv
uv add jsonschema-typed-v2poetry
poetry add jsonschema-typed-v2Installing jsonschema-typed-v2
Before you install
Low friction—pure Python wheel with only jsonschema and mypy as runtime dependencies. However, maintenance is dormant: last release was 2020-08-11 and last commit 2023-10-03. The package is a maintained fork of an abandoned original, so stability depends on whether the current maintainer continues to support mypy plugin API changes.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source contexts.
Quickstart
pip install jsonschema-typed-v2
# In mypy.ini:
# [mypy]
# plugins = jsonschema_typed.plugin, jsonschema_typed.optional_typed_dict
# cache_dir = /dev/null
from jsonschema_typed import JSONSchema
data: JSONSchema["path/to/schema.json"] = {"title": "example"}
Requires mypy plugin system integration via mypy.ini configuration and disabling mypy cache. mypy plugin API has no backwards compatibility guarantee, so future mypy versions may break this package.
Verify before relying
- Whether current mypy versions (post-0.761) are supported; the fact sheet mentions testing only with mypy==0.761.
- Whether the package works with modern Python 3.11+ or only up to 3.8 as classifiers suggest.
- Scope of JSON Schema features actually supported beyond the basic types listed (draft-07 compliance level).
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — jsonschema, mypy |
| Maintenance | dormant — 2,194 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 172,461/month — #10,337 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: jsonschema_typed_v2-0.8.0-py3-none-any.whl
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
marshmallow-jsonschemaConverts marshmallow schemas into JSON Schema…
permissive · top 5,000 on PyPI
jsonschema-pydanticConverts JSON Schema definitions into Pydantic…
unclear · top 15,000 on PyPI
jsonschemajsonschema validates Python data structures…
permissive · top 100 on PyPI
jsonschema-specificationsProvides JSON Schema metaschemas, vocabularies,…
permissive · top 100 on PyPI
gensonGenSON generates JSON Schema documents from…
permissive · top 5,000 on PyPI
json-ref-dictProvides a dict-like interface to JSONSchema…
permissive · top 15,000 on PyPI
sentry-kafka-schemasProvides Kafka topic definitions and JSON…
unclear · top 15,000 on PyPI
hypothesis-jsonschemaGenerates random JSON data that conforms to a…
copyleft · top 5,000 on PyPI
jsonschema-gentypesGenerates Python TypedDict types from JSON…
permissive · top 15,000 on PyPI
jsonaliasProvides a recursive type alias for…
permissive · top 5,000 on PyPI