For bugs/questions:
import sys; print(sys.version)
: 3.7.3import pydantic; print(pydantic.VERSION)
: 0.25Running the code below to generate schema causes a recursion error.
from __future__ import annotations import typing from pydantic import BaseModel, Schema class Account(BaseModel): name: str subaccounts: typing.List[Account] = [] Account.update_forward_refs() print(Account.schema_json(indent=2)) ...
Snippet of recursion traceback
... flat_models |= get_flat_models_from_model(field.type_) File "/home/nav/.local/share/virtualenvs/project-oxBoBmI4/lib/python3.7/site-packages/pydantic/schema.py", line 355, in get_flat_models_from_model flat_models |= get_flat_models_from_fields(fields) File "/home/nav/.local/share/virtualenvs/project-oxBoBmI4/lib/python3.7/site-packages/pydantic/schema.py", line 394, in get_flat_models_from_fields flat_models |= get_flat_models_from_field(field) File "/home/nav/.local/share/virtualenvs/project-oxBoBmI4/lib/python3.7/site-packages/pydantic/schema.py", line 373, in get_flat_models_from_field elif lenient_issubclass(field.type_, main.BaseModel): File "/home/nav/.local/share/virtualenvs/project-oxBoBmI4/lib/python3.7/site-packages/pydantic/utils.py", line 232, in lenient_issubclass return isinstance(cls, type) and issubclass(cls, class_or_tuple) File "/home/nav/.local/share/virtualenvs/project-oxBoBmI4/lib/python3.7/abc.py", line 143, in __subclasscheck__ return _abc_subclasscheck(cls, subclass) RecursionError: maximum recursion depth exceeded in comparison
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4