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
Currently callbacks, paths and responses are modelled as dicts, but that breaks support for specification extensions.
An alternative solution would be to use before-validation to catch all non-extension entries and put them in a dict inside the model, and leave extensions to be handled by extra. Basically all dynamic names would be pushed down into a dict. This would improve compatibility with python but break 1-1 mapping with the JSON representation, and would need to be coupled with pre-processing during serialization.
Hey @rafalkrupinski - happy to accept a contribution for this. In general I'd prefer to maintain support for Pydantic v1 + v2 for now until v1 support is dropped on the Pydantic side, so if you could extend the v2 approach with the compat module that would be ideal (it can be a bit fiddly though with typing)
Currently callbacks, paths and responses are modelled as dicts, but that breaks support for specification extensions.
An alternative solution would be to use before-validation to catch all non-extension entries and put them in a dict inside the model, and leave extensions to be handled by
extra
. Basically all dynamic names would be pushed down into a dict. This would improve compatibility with python but break 1-1 mapping with the JSON representation, and would need to be coupled with pre-processing during serialization.I've done something roughly similar but only for V2 and only for parsing.
The text was updated successfully, but these errors were encountered: