Skip to content

Support pydantic field's alias #80

Description

@igoose1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions