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 pydantic field's alias #80

Open
igoose1 opened this issue May 25, 2023 · 0 comments
Open

Support pydantic field's alias #80

igoose1 opened this issue May 25, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@igoose1
Copy link

igoose1 commented May 25, 2023

I suggest to support pydantic.Field.alias field. Currently erdantic ignores it.

That's an example with simple Gift class:

from pydantic import BaseModel, Field


class Gift(BaseModel):
    for_: str = Field(alias="for")

erdantic produces:

image

Although, pydantic displays a field as for:

>>> Gift.schema()
{'title': 'Gift', 'type': 'object', 'properties': {'for': {'title': 'For', 'type': 'string'}},
'required': ['for']}

Libraries like FastAPI use that schema in Swagger generations.

@jayqi jayqi added the enhancement New feature or request label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants