Initial Checks
Description
when instanciating a dataclass where a property is a list or dict of another dataclass, it causes this error:
extra fields not permitted (type=value_error.extra)
Example Code
from pydantic import Extra
from pydantic.dataclasses import dataclass
class ExtraPropertiesForbidden:
extra = Extra.forbid
@dataclass(config=ExtraPropertiesForbidden)
class Bar:
...
@dataclass(config=ExtraPropertiesForbidden)
class Foo:
a: list[Bar]
a = Foo(a=[Bar()]) # error: extra fields not permitted (type=value_error.extra)
Python, Pydantic & OS Version
this issue seems to have been introduced after the 1.9.1 release. this occurred after installing the latest commit from master:
pip uninstall pydantic
pip install git+https://github.com/samuelcolvin/pydantic.git@a69136d2096e327ed48954a298c775dceb1551d1
pydantic version: 1.9.0
pydantic compiled: False
install path: C:\Users\chungus\AppData\Local\pypoetry\Cache\virtualenvs\project-e01-Hfn1-py3.10\Lib\site-packages\pydantic
python version: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
platform: Windows-10-10.0.19042-SP0
optional deps. installed: ['typing-extensions']
Affected Components
Initial Checks
Description
when instanciating a
dataclasswhere a property is alistordictof anotherdataclass, it causes this error:Example Code
Python, Pydantic & OS Version
this issue seems to have been introduced after the 1.9.1 release. this occurred after installing the latest commit from master:
Affected Components
.dict()and.json()construct(), pickling, private attributes, ORM mode