--- id: jsonschema-gentypes version: "2.13.0" license: BSD-2-Clause license_treatment: permissive maintenance: active --- # jsonschema-gentypes — Tool to generate Python types based on TypedDict from a JSON Schema License: permissive · Maintenance: active · Downloads: 75.4K/mo ## What it is and what it does jsonschema-gentypes is a command-line tool that reads JSON Schema files and generates Python source code containing TypedDict type definitions. It bridges the gap between schema-first API design and Python's static type system, letting you define your data contracts once in JSON Schema and automatically produce typed Python code that can be validated against those schemas. The tool supports both standard JSON Schema and OpenAPI3 schemas, automatically detecting which format you're using. It integrates with code formatters like black and isort, can be run as a pre-commit hook, and exports default values from the schema so you can use them in your Python code. It requires Python 3.10 or later and depends on jsonschema, PyYAML, requests, referencing, typing-extensions, and urllib3. Use it for: - Generate type-safe request/response models from an OpenAPI3 specification for use in web frameworks like Pyramid or FastAPI. - Maintain a single JSON Schema as the source of truth for data validation while keeping Python types automatically in sync. - Integrate schema-driven code generation into CI/CD pipelines via pre-commit hooks to catch type mismatches early. - Build strongly-typed data validation layers in microservices without manually writing TypedDict classes. - Generate Python types from shared JSON Schema definitions across multiple services or repositories. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Generates Python TypedDict types from JSON Schema definitions, with support for OpenAPI3 schemas and automatic code formatting. Yes. The package is actively maintained, has no known vulnerabilities, uses a permissive license, and solves a real problem for teams using schema-first API design. Install friction is low and it integrates well into existing workflows via CLI, config files, and pre-commit hooks. Suitable for production use. ## Install pip install jsonschema-gentypes uv add jsonschema-gentypes poetry add jsonschema-gentypes ## Installing jsonschema-gentypes Before you install: Low friction: pure Python wheel with six common runtime dependencies (PyYAML, jsonschema, referencing, requests, typing-extensions, urllib3). Actively maintained with recent release and no known vulnerabilities. License in practice: BSD-2-Clause is permissive; you can use this in commercial and proprietary projects with minimal restrictions beyond retaining the license notice. Quickstart: pip install jsonschema-gentypes jsonschema-gentypes --json-schema=schema.json --python=types.py # Or via config file (jsonschema-gentypes.yaml): jsonschema-gentypes Requires Python 3.10 or later (supports 3.10, 3.11, 3.12, 3.13). Verify before relying: - Whether generated types are fully compatible with runtime type checkers like mypy and pyright in all schema patterns. - Performance characteristics when processing very large or deeply nested JSON schemas. - Completeness of OpenAPI3 support relative to the full OpenAPI3 specification. ## Package facts - License: BSD-2-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 75.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags json schema to python types, typeddict generator, json schema code generation, openapi3 python types, schema-driven type generation, json schema validation types, automatic python type stubs, code-generation, schema-driven, type-safety [View on SkillFed](https://skillfed.io/packages/jsonschema-gentypes) · [View on PyPI](https://pypi.org/project/jsonschema-gentypes/)