Skip to main content

Generate Pydantic Fields with typing.Annotated

Project description

pydantic-annotated

Proof of concept Decomposing Field components into Annotated.

from typing import Annotated

from pydantic_annotated import BaseModel, Description, FieldAnnotationModel


class PII(FieldAnnotationModel):
    status: bool


class ComplexAnnotation(FieldAnnotationModel):
    x: int
    y: int


class Patient(BaseModel):
    name: str
    condition: Annotated[
        str,
        ComplexAnnotation(x=1, y=2),
        Description("Patient condition"),
        PII(status=True),
    ]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic-annotated-0.0.1a0.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

pydantic_annotated-0.0.1a0-py3-none-any.whl (3.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page