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
I am currently in the process of migrating Pydantic from version 1 to version 2 in a huge FastAPI app.
Summing up a lot, we have set up some logic that allows us to inherite from an existing Pydantic model and specify if we want a reduced set of fields in the new model. For that, we have a method and logic as follows:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am currently in the process of migrating Pydantic from version 1 to version 2 in a huge FastAPI app.
Summing up a lot, we have set up some logic that allows us to inherite from an existing Pydantic model and specify if we want a reduced set of fields in the new model. For that, we have a method and logic as follows:
Concretely for this piece:
I would expect that it could be migrated to something like the following, by having a look at the migration guide:
However, it seems that the new
__pydantic_validator__
property does not have anitems()
method.Is there any way of migrating this small piece of logic?
Beta Was this translation helpful? Give feedback.
All reactions