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 have searched Google & GitHub for similar requests and couldn't find anything
I have read and followed the docs and still think this feature is missing
Description
I would like to change the extra configuration of a model dynamically at runtime / validation time.
Example of hypothetical implementation:
SomeModel(BaseModel):
my_field: intmodel_config=ConfigDict(extra="allow")
data=SomeModel.model_validate(
{"myfield": 1, "extra field": 2},
extra="forbid"# override model config and forbid extra fields just this time
)
Initial Checks
Description
I would like to change the
extra
configuration of a model dynamically at runtime / validation time.Example of hypothetical implementation:
Affected Components
.model_dump()
and.model_dump_json()
model_construct()
, pickling, private attributes, ORM modeThe text was updated successfully, but these errors were encountered: