Skip to main content

didactic-fastapi

PyPI Python License CI Docs

didactic-fastapi adapts dx.Model classes for FastAPI request validation, response validation, and OpenAPI generation. It adds the didactic.fastapi module and uses didactic-pydantic at the framework boundary.

Install

pip install didactic-fastapi

The distribution depends on didactic, didactic-pydantic, and fastapi>=0.115.

Use a Didactic response model

import didactic.api as dx
from didactic.fastapi import as_response, register_validation_handler
from fastapi import FastAPI


class User(dx.Model):
    id: str
    email: str


app = FastAPI()
register_validation_handler(app)


@app.get("/users/{user_id}", response_model=as_response(User))
def get_user(user_id: str) -> User:
    return User(id=user_id, email="ada@example.org")

as_response(User) returns a cached pydantic.BaseModel subclass that mirrors User. FastAPI uses that class for validation and OpenAPI generation.

Adapter behavior

Function Behavior
as_response(model) returns the generated Pydantic class for a response model
as_request(model) returns the same adapter under a request-oriented name
register_validation_handler(app) converts dx.ValidationError raised in a route into a FastAPI-style 422 response

Models with dx.indexed_by fields retain their cross-field validation. Their known index cases also appear as conditional constraints in the generated OpenAPI schema.

Documentation

See the FastAPI guide for request models, response models, error handling, and integration limits.

License

Released under the MIT License.

Metadata

Release files for didactic-fastapi 0.18.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for didactic-fastapi 0.18.1
File Size Uploaded Provenance Actions
didactic_fastapi-0.18.1.tar.gz 3.4 kB With provenance Details for didactic_fastapi-0.18.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for didactic-fastapi 0.18.1
File Interpreter ABI Platform Actions
didactic_fastapi-0.18.1-py3-none-any.whl Python 3 none any Details for didactic_fastapi-0.18.1-py3-none-any.whl

Total release size: 7.7 kB

Release files / didactic_fastapi-0.18.1.tar.gz

Download URL didactic_fastapi-0.18.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9477445993680074061c434d7ee568f99d82d5cde7db1ae67da326f04b7f48f3
BLAKE2b-256 checksum
How to use checksums
76e087a4f970dbf7ee4a123584ed14853effcceeb200f401315303ce1c225de7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / didactic_fastapi-0.18.1-py3-none-any.whl

Download URL didactic_fastapi-0.18.1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e9d46122d1a5ef5cdb77f05c55140723331ac032e5e3576b6eec5952fbc0579
BLAKE2b-256 checksum
How to use checksums
d0b1bb11e216c846c57ad903c5470ffc6ec2cdd6e0559dc8e9161faf02a9f3ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for didactic-fastapi 0.18.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for didactic_fastapi-0.18.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.18.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page