drivendataorg / drivendataorg/erdantic
Support pydantic field's alias
- Dominant language
- Python
- Stars
- 419
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Description
I suggest to support `pydantic.Field.alias` field. Currently erdantic ignores it.
That's an example with simple `Gift` class:
```python3
from pydantic import BaseModel, Field
class Gift(BaseModel):
for_: str = Field(alias="for")
```
erdantic produces:

Although, pydantic displays a field as `for`:
```python3
>>> Gift.schema()
{'title': 'Gift', 'type': 'object', 'properties': {'for': {'title': 'For', 'type': 'string'}},
'required': ['for']}
```
Libraries like FastAPI use that schema in Swagger generations.
Contributor guide
Research direction
Reproduce the issue with the provided Gift model and compare erdantic's diagram with Pydantic's Gift.schema() output, focusing on Field(alias="for"). Then locate the part of the repository that reads Pydantic model fields and determine how to make the diagram use the alias while preserving a passing test for the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100