We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Python 3.12 introduced a new syntax "type statements" for declaring type aliases.
erdantic currently handles the old simple assignment syntax for type aliases, but not type statements.
from typing import List import erdantic as erd from pydantic import BaseModel import rich class MyInnerModel(BaseModel): field: str MyAlias = List[MyInnerModel] print(type(MyAlias)) #> <class 'typing._GenericAlias'> class MyOuterModel(BaseModel): aliased_field: MyAlias diagram = erd.create(MyOuterModel) rich.print(diagram) #> EntityRelationshipDiagram( #> models={'__main__.MyInnerModel': ModelInfo(...), '__main__.MyOuterModel': ModelInfo(...)}, #> edges={'__main__.MyOuterModel-aliased_field-__main__.MyInnerModel': Edge(...)} #> )
from typing import List import erdantic as erd from pydantic import BaseModel import rich class MyInnerModel(BaseModel): field: str type MyAlias = List[MyInnerModel] print(type(MyAlias)) #> <class 'typing.TypeAliasType'> class MyOuterModel(BaseModel): aliased_field: MyAlias diagram = erd.create(MyOuterModel) rich.print(diagram) #> EntityRelationshipDiagram(models={'__main__.MyOuterModel': ModelInfo(...)}, edges={})
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Python 3.12 introduced a new syntax "type statements" for declaring type aliases.
erdantic currently handles the old simple assignment syntax for type aliases, but not type statements.
Works
Does not work
The text was updated successfully, but these errors were encountered: