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
The provided snippet works fine on 1.7.4, but does not on 1.8.x. git bisect points to #2238 as first bad commit. The culprit seems to be the validate method, where value is wrapped with the dict under ROOT_KEY, leading to validation error.
frompydanticimportBaseModel, FieldclassNestedModel(BaseModel):
__root__: int=Field(..., alias='x')
classMyModel(BaseModel):
v: NestedModelMyModel(**{'v': {'x': 2}})
# pydantic.error_wrappers.ValidationError: 1 validation error for MyModel# v -> x# field required (type=value_error.missing)
The text was updated successfully, but these errors were encountered:
Checks
Bug
Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
:The provided snippet works fine on
1.7.4
, but does not on1.8.x
.git bisect
points to #2238 as first bad commit. The culprit seems to be thevalidate
method, where value is wrapped with the dict underROOT_KEY
, leading to validation error.The text was updated successfully, but these errors were encountered: