-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
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.
class Paths(BaseModel)
paths = dict[str, PathItem]
if PYDANTIC_V2:
@validate_model
def validate():...
@model_serializer
def serialize():...
else:
class Config:
json_loads = load_paths
json_dumps = dump_paths
I've done something roughly similar but only for V2 and only for parsing.
Metadata
Metadata
Assignees
Labels
No labels