-
-
Notifications
You must be signed in to change notification settings - Fork 740
🐛 Fix Pydantic alias
bug
#1379
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
base: main
Are you sure you want to change the base?
🐛 Fix Pydantic alias
bug
#1379
Conversation
This workaround fixes Pydantic serialization/deserialization while not modifying the internal alias logic. I cannot figure out why alias is not being passed through anymore. For example, I was needing to add schema_extra with these key values in order to read data from a Json with different field names. Thank you for your consideration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I tested it on a SQLModel and it works fine. It keeps the syntax clean by using the same alias field.
Hi @STocidlowski, thanks for the contribution! Do you have a minimal reproducible example that shows the bug on |
Thanks for this useful fix. It work for my usecase : Reproductible example :
|
a workaround is the usage of |
bug
/This workaround fixes Pydantic serialization/deserialization while not modifying the internal alias logic. I cannot figure out why alias is not being passed through anymore.
For example, I was needing to add schema_extra with these key values in order to read/write data from a Json
https://docs.pydantic.dev/latest/concepts/fields/#field-aliases
#290
Thank you for your consideration.