You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Great work with Ormar so far, been a real pleasure using it!
As originally posted by @collerek in #315 (comment), it appears that pydantic aliases are not yet supported.
Currently we are working with ormar to deal with data generated by another system, and are not able to control the keys of the data when it shows up as JSON. We have seen a few collisions between pydantic BaseModel attributes and keys we are encountering, and would love a clean way to keep these separate.
Any thoughts on how to manage this, or where we could dive into the repo at to implement this ourselves?
Is your feature request related to a problem? Please describe.
Problem: Need to be able to use pydantic alias, or manage models with fields whos name shadows pydantic BaseModel attributes. Currently encounter issues like:
NameError: Field name "validate" shadows a BaseModel attribute; use a different field name with "alias='validate'".
When attempting to use fields that shadow.
Describe the solution you'd like
Implement pydantic aliasing, to avoid issues with Field names shadowing pydantic BaseModel attributes
Describe alternatives you've considered
As a quick and dirty workaround that doesn't involve creating a second pydantic class, we are simply recursively renaming offending keys on deserialization, and reversing that process later.
Activity