--- id: jsonschema-typed-v2 version: "0.8.0" license: MIT license_treatment: permissive maintenance: dormant --- # jsonschema-typed-v2 — Automatic type annotations from JSON schemas License: permissive · Maintenance: dormant · Downloads: 172.5K/mo ## 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 above — 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 pip install jsonschema-typed-v2 uv add jsonschema-typed-v2 poetry add jsonschema-typed-v2 ## Installing 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_current - Install friction: low - Maintenance: dormant - Downloads: 172.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags json schema to python types, automatic type annotations from json, typeddict generator json schema, mypy plugin json validation, static typing for json data, json schema type checking, python typing from json schema, type-checking, json-schema, mypy-plugin [View on SkillFed](https://skillfed.io/packages/jsonschema-typed-v2) · [View on PyPI](https://pypi.org/project/jsonschema-typed-v2/)