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

Consider refactoring RootModel pattern for discriminated unions to use TypeAliasType #114

Open
bruno-f-cruz opened this issue Oct 22, 2024 · 0 comments

Comments

@bruno-f-cruz
Copy link
Collaborator

Following pydantic/pydantic#10635 (comment)

Seems like TypeAliasType would be a more friendly solution to solve this pattern. A quick tests shows that the only thing that is lost (which is not even being used at the moment) is the title of the root model on model construction.

Additionally, the TypeAliasType class does not seem to be importable from the typing module in 3.11 despite what is written in the OP, instead it must be imported from typing_extensions as of 3.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant