skillfed

warchant_dc_schema

Generate JSON schema from python dataclasses

warchant-dc-schema v0.0.10 102.6K downloads/30d#12,858 on PyPI23
Permissive license MIT DORMANT released

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-schema

uv

uv add warchant-dc-schema

poetry

poetry add warchant-dc-schema

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9

Tags

json schema from dataclassesdataclass to json schemagenerate json schema pythonschema validation dataclassesjson schema generatordataclass schema exportpython dataclass validation
schema-generationdataclass-toolingjson-schema

More Software Development packages