We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
pydantic version: 1.9.1 pydantic compiled: True install path: /usr/local/lib/python3.7/dist-packages/pydantic python version: 3.7.13 (default, Apr 24 2022, 01:04:09) [GCC 7.5.0] platform: Linux-5.4.188+-x86_64-with-Ubuntu-18.04-bionic optional deps. installed: ['typing-extensions']
import pydantic from dataclasses import dataclass @dataclass class ClassA(): foo: str bar: float @dataclass class ClassB(): a1: ClassA a2: ClassA pydantic_cls = pydantic.dataclasses.dataclass(ClassB) schema = pydantic_cls.__pydantic_model__.schema()
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) [<ipython-input-5-575c54138c2b>](https://localhost:8080/#) in <module>() 14 15 pydantic_cls = pydantic.dataclasses.dataclass(ClassB) ---> 16 schema = pydantic_cls.__pydantic_model__.schema() 6 frames /usr/local/lib/python3.7/dist-packages/pydantic/schema.cpython-37m-x86_64-linux-gnu.so in pydantic.schema.field_singleton_schema() KeyError: <class 'pydantic.dataclasses.ClassA'>
However, the same structure with BaseModel works fine.
BaseModel
import pydantic from pydantic import BaseModel class ClassA(BaseModel): foo: str bar: float class ClassB(BaseModel): a1: ClassA a2: ClassA pydantic_cls = pydantic.dataclasses.dataclass(ClassB) schema = pydantic_cls.__pydantic_model__.schema() # no error :)
The text was updated successfully, but these errors were encountered:
I wonder if this would be fixed by #2557?
I think honestly at this stage of pydantic V1, we might have to call this a limitation of pydantic.
Sorry, something went wrong.
No answer, so I'll assume this is fixed by #2557.
No branches or pull requests
Checks
Bug
Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
:However, the same structure with
BaseModel
works fine.The text was updated successfully, but these errors were encountered: