warchant_dc_schema
Generate JSON schema from python dataclasses
What it is and what it does
warchant_dc_schema is a lightweight, zero-dependency library that converts Python dataclasses into valid JSON Schema (2020-12 draft) documents. It reads dataclass field types, defaults, and optional metadata annotations to produce schema output suitable for validation, documentation, or API specifications.
The package is designed as a minimal alternative when you only need schema generation from plain dataclasses. It supports nested dataclasses, optional fields, datetime types, and custom metadata via typing.Annotated. You can also customize dataclass-level schema properties using a SchemaConfig inner class. Recent versions add patternProperties and additionalProperties support. The library includes a CLI tool and a test suite demonstrating supported features.
Use it for:
- Generate OpenAPI or JSON Schema documentation from dataclass-based API request/response models.
- Validate incoming JSON data against a schema derived from your dataclass definitions.
- Export dataclass structures as reusable schema files for cross-language API contracts.
- Add schema metadata (descriptions, examples, validation rules) to dataclasses without a full validation framework.
- Build lightweight schema-driven tools or code generators that operate on dataclass definitions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates JSON Schema (2020-12 draft) from Python dataclasses with no external dependencies, using only the standard library.
Yes, if you need lightweight JSON schema generation from dataclasses and want to avoid large dependencies. The zero-dependency design and standard-library-only approach make it easy to integrate. However, dormant maintenance (last commit 2024-02-13) means you should expect no active bug fixes or feature updates; use it for stable, self-contained schema generation tasks, not as a foundation for rapidly evolving systems.
Install
warchant-dc-schema on PyPI
pip
pip install warchant-dc-schemauv
uv add warchant-dc-schemapoetry
poetry add warchant-dc-schemaInstalling warchant_dc_schema
Before you install
Low friction install with no runtime dependencies. Dormant maintenance status (last commit 2024-02-13, 913 days since release) means no active development, though the repository is not archived.
License in practice
MIT license permits commercial and private use with minimal restrictions—you may use, modify, and distribute the package freely provided you include the license notice.
Quickstart
pip install warchant-dc-schema
import dataclasses
from warchant_dc_schema import get_schema
@dataclasses.dataclass
class Book:
title: str
published: bool = False
schema = get_schema(Book)
Requires Python 3.9 or later (requires_python: >=3.9,<4.0).
Verify before relying
- Whether patternProperties and additionalProperties features (added in 0.0.9–0.0.10) are production-ready or experimental.
- Real-world validation performance compared to alternatives for large or deeply nested dataclass hierarchies.
- Whether the CLI tool is actively maintained or documented beyond the brief mention in the description.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9,<4.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 913 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 102,621/month — #12,858 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: warchant_dc_schema-0.0.10-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
gensonGenSON generates JSON Schema documents from…
permissive · top 5,000 on PyPI
hologramGenerates Draft 7 compatible JSON Schemas…
permissive · top 5,000 on PyPI
desertDesert generates marshmallow serialization…
permissive · top 15,000 on PyPI
dataclasses-jsonschemaGenerates JSON Schema from Python dataclasses…
permissive · top 15,000 on PyPI
dataclasses-avroschemaGenerates Avro schemas from Python dataclasses,…
permissive · top 5,000 on PyPI
marshmallow-jsonschemaConverts marshmallow schemas into JSON Schema…
permissive · top 5,000 on PyPI
tinselGenerates PySpark DataFrame schemas from Python…
permissive · top 15,000 on PyPI
apischemaApischema handles JSON…
permissive · top 15,000 on PyPI
ocsf-libProvides Python tools to compile, validate,…
permissive · top 15,000 on PyPI
pyion2jsonConverts Amazon Ion documents and QLDB query…
permissive · top 15,000 on PyPI