-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X
Description
Checks
- I added a descriptive title to this issue
- I have searched (google, github) for similar issues and couldn't find anything
- I have read and followed the docs and still think this is a bug
Bug
Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":
pydantic version: 1.8.2
pydantic compiled: False
install path: /home/sergej/Projects/pydantic/pydantic
python version: 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
platform: Linux-5.4.0-72-generic-x86_64-with-glibc2.29
optional deps. installed: ['devtools', 'dotenv', 'email-validator', 'typing-extensions']
Description
The AssertionError occurs on JSON schema generation if Deque field used in the Pydantic model.
Example
from typing import Deque
from pydantic import BaseModel
class Model(BaseModel):
a: Deque[str]
Model.schema()Output
Traceback (most recent call last):
File "/home/sergej/Projects/pydantic/test_deque.py", line 10, in <module>
Model.schema()
File "/home/sergej/Projects/pydantic/pydantic/main.py", line 720, in schema
s = model_schema(cls, by_alias=by_alias, ref_template=ref_template)
File "/home/sergej/Projects/pydantic/pydantic/schema.py", line 168, in model_schema
m_schema, m_definitions, nested_models = model_process_schema(
File "/home/sergej/Projects/pydantic/pydantic/schema.py", line 557, in model_process_schema
m_schema, m_definitions, nested_models = model_type_schema(
File "/home/sergej/Projects/pydantic/pydantic/schema.py", line 598, in model_type_schema
f_schema, f_definitions, f_nested_models = field_schema(
File "/home/sergej/Projects/pydantic/pydantic/schema.py", line 242, in field_schema
f_schema, f_definitions, f_nested_models = field_type_schema(
File "/home/sergej/Projects/pydantic/pydantic/schema.py", line 503, in field_type_schema
assert field.shape in {SHAPE_SINGLETON, SHAPE_GENERIC}, field.shape
AssertionError: 11DarkAce65
Metadata
Metadata
Assignees
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X