--- id: apischema version: "0.19.0" license: MIT license_treatment: permissive maintenance: active --- # apischema — JSON (de)serialization, GraphQL and JSON schema generation using Python typing. License: permissive · Maintenance: active · Downloads: 158.3K/mo ## What it is and what it does Apischema is a Python library for converting between Python objects and JSON, generating GraphQL schemas, and producing JSON schemas—all driven by standard Python type annotations and dataclasses. It works with any type (dataclasses, NewType, generic collections) without requiring a base class, and integrates with your IDE and type checker naturally. The library is designed to stay close to Python's standard library (dataclasses, typing) rather than imposing its own object model. It handles validation during deserialization, generates schemas for documentation and API contracts, and supports GraphQL as a first-class concern alongside JSON. It has no runtime dependencies and supports Python 3.9 and later, including PyPy3. Use it for: - Deserialize and validate JSON API responses into typed Python dataclasses with automatic error reporting. - Generate JSON Schema and GraphQL schemas from your existing dataclass definitions for API documentation. - Serialize Python dataclass instances back to JSON for API responses without manual field mapping. - Build GraphQL query resolvers that work directly with your Python type annotations. - Adapt the library to support custom types (ORM models, attrs classes) via its conversion system. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Apischema handles JSON serialization/deserialization, GraphQL schema generation, and JSON schema generation directly from Python type annotations and dataclasses, with no base class requirement. Yes. Apischema is actively maintained, has no dependencies, supports current Python versions, and solves a real problem (API data handling) without imposing a base class or breaking from standard library conventions. The MIT license is permissive. No known security vulnerabilities. Suitable for production use in API clients and servers. ## Install pip install apischema uv add apischema poetry add apischema ## Installing apischema Before you install: Low install friction with no runtime dependencies. Active maintenance with recent commits and a steady release cadence since 2020; last release 2024-10-01. License in practice: MIT license permits commercial and private use with minimal restrictions; you must include a copy of the license and copyright notice. Quickstart: pip install apischema from dataclasses import dataclass from apischema import deserialize, serialize @dataclass class Item: name: str value: int data = {"name": "example", "value": 42} item = deserialize(Item, data) result = serialize(Item, item) Requires Python 3.9 or later; PyPy3 is supported. Verify before relying: - Whether performance claims ('a lot faster') have been independently verified against current versions of competing libraries. - Whether the GraphQL implementation is feature-complete relative to graphql-core or other GraphQL libraries. - Real-world adoption patterns and ecosystem integration beyond the documented examples. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 158.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags json serialization deserialization python, graphql schema generation typing, json schema from dataclasses, api data validation python, type-driven serialization, json-serialization, graphql, type-annotations [View on SkillFed](https://skillfed.io/packages/apischema) · [View on PyPI](https://pypi.org/project/apischema/)