Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support typing.Annotated annotations #52

Merged
merged 7 commits into from
Mar 30, 2024

Conversation

surenkov
Copy link
Owner

@surenkov surenkov commented Mar 24, 2024

This PR is related to #31

This PR adds the support of typing.Annotated[...] expressions, both through schema= attribute or field annotation syntax; though I find the schema=typing.Annotated[...] variant highly discouraged.

The current limitation is not in the field itself, but in possible Annotated metadata -- practically it can contain anything, and Django migrations serializers could refuse to write it to migrations.

For most relevant types in context of Pydantic, I wrote the specific serializers (particularly for pydantic.FieldInfo, pydantic.Representation and raw dataclasses), thus it should cover the majority of Annotated use cases

@surenkov surenkov added enhancement New feature or request pydantic:2 labels Mar 24, 2024
@surenkov surenkov self-assigned this Mar 24, 2024
@surenkov surenkov force-pushed the feature/typing-annotated-support branch 2 times, most recently from 5f2f9a1 to 1170c7a Compare March 24, 2024 16:29
@surenkov surenkov force-pushed the feature/typing-annotated-support branch 11 times, most recently from 4c9e871 to 5168a12 Compare March 25, 2024 22:01
@surenkov surenkov force-pushed the feature/typing-annotated-support branch from d6266ca to 59203db Compare March 25, 2024 22:37
@surenkov surenkov force-pushed the feature/typing-annotated-support branch from 536986f to e07df71 Compare March 30, 2024 13:46
@surenkov surenkov changed the title [WIP] Support typing.Annotated annotations Support typing.Annotated annotations Mar 30, 2024
@surenkov surenkov marked this pull request as ready for review March 30, 2024 13:47
@surenkov surenkov force-pushed the feature/typing-annotated-support branch from d17efc6 to 7d490a7 Compare March 30, 2024 14:38
@surenkov surenkov merged commit ef706b5 into master Mar 30, 2024
14 checks passed
@surenkov surenkov deleted the feature/typing-annotated-support branch March 30, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pydantic:2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant