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
Expected behavior
No error or impossible to install with old version of Pydantic.
Current behavior
Traceback (most recent call last):
File "/home/adam/.pyenv/versions/3.9.13/bin/datamodel-codegen", line 5, in <module>
from datamodel_code_generator.__main__ import main
File "/home/adam/.pyenv/versions/3.9.13/lib/python3.9/site-packages/datamodel_code_generator/__init__.py", line 35, in <module>
from datamodel_code_generator.parser.base import Parser
File "/home/adam/.pyenv/versions/3.9.13/lib/python3.9/site-packages/datamodel_code_generator/parser/base.py", line 30, in <module>
from datamodel_code_generator.model import pydantic as pydantic_model
File "/home/adam/.pyenv/versions/3.9.13/lib/python3.9/site-packages/datamodel_code_generator/model/__init__.py", line 5, in <module>
from ..types import DataTypeManager as DataTypeManagerABC
File "/home/adam/.pyenv/versions/3.9.13/lib/python3.9/site-packages/datamodel_code_generator/types.py", line 54, in <module>
from datamodel_code_generator.reference import Reference, _BaseModel
File "/home/adam/.pyenv/versions/3.9.13/lib/python3.9/site-packages/datamodel_code_generator/reference.py", line 50, in <module>
class _BaseModel(BaseModel):
File "pydantic/main.py", line 282, in pydantic.main.ModelMetaclass.__new__
File "pydantic/typing.py", line 287, in pydantic.typing.resolve_annotations
For use of globalns and localns see the docstring for get_type_hints().
File "/home/adam/.pyenv/versions/3.9.13/lib/python3.9/typing.py", line 292, in _eval_type
return t._evaluate(globalns, localns, recursive_guard)
File "/home/adam/.pyenv/versions/3.9.13/lib/python3.9/typing.py", line 553, in _evaluate
type_ = _type_check(
File "/home/adam/.pyenv/versions/3.9.13/lib/python3.9/typing.py", line 158, in _type_check
raise TypeError(f"{arg} is not valid as type argument")
TypeError: typing.ClassVar[typing.Set[str]] is not valid as type argument
Version:
OS: linux mint
Python version: 3.9.13
datamodel-code-generator version: 0.14.0 - 0.22.0
The text was updated successfully, but these errors were encountered:
Describe the bug
Looks like datamodel-code-generator >=0.14.0 is not compatible with pydantic 1.8.
To Reproduce
pip install datamodel-code-generator==0.22.0 pydantic==1.8.2 datamodel-codegen --input example.yml --input-file-type=openapi --output example.py --output-model-type="pydantic.BaseModel"
Example schema:
Used commandline:
Expected behavior
No error or impossible to install with old version of Pydantic.
Current behavior
Version:
The text was updated successfully, but these errors were encountered: