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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file pydantic-annotated-0.0.1a0.tar.gz.

File metadata

  • Download URL: pydantic-annotated-0.0.1a0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.0 Darwin/20.1.0

File hashes

Hashes for pydantic-annotated-0.0.1a0.tar.gz
Algorithm Hash digest
SHA256 23822d59e30d9dd2ba6212367f387dbb610ddecb921e7976aeda17275355cc0b
MD5 234a9254ae7bb822da96f931063a74dc
BLAKE2b-256 7569a8150f7ec866ccb80918844495fb08283480c7e08bd7e117c7fc04a26678

See more details on using hashes here.

File details

Details for the file pydantic_annotated-0.0.1a0-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_annotated-0.0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3c14be64274433247b0b4725762633a39369180a4ff22d6099b036308ffd883
MD5 7bcda66694164e2b1ac0d5820ff42ef1
BLAKE2b-256 06bb4f09d5cce9df7c55fd56dd711917d213506c4f7b6d7b48963d944b350b72

See more details on using hashes here.

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