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
If necessary for the use cases you have in mind, I think we could also do this with functional discriminators in the case where there is a required field that is only present in one of the cases. If inferring for literals/enum discriminators is enough then that's probably less effort
Initial Checks
Description
We should have a config setting which causes Pydantic to try to infer union discriminators.
It's shouldn't try to do anything too clever, it should just look for:
If so, generate a discriminator.
Affected Components
.model_dump()
and.model_dump_json()
model_construct()
, pickling, private attributes, ORM modeThe text was updated successfully, but these errors were encountered: