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
Describe the bug
If multiple properties use the same $ref, with one of those properties having the same name as the $ref, the generated code fails mypy checks with a [name-defined] error.
$ datamodel-codegen --input example/ --output example_output/ --field-constraints
$ mypy example_output/ --show-error-codes
example_output/example.py:16: error: Name "identifier.Identifier" is not defined [name-defined]
Found 1 error in 1 file (checked 3 source files)
Expected behavior
I would expect the generated code to pass mypy checks with no errors. Since the error appears to be caused by the from . import identifier import, changing this to be from . import identifier as identifier_ would work.
Version:
OS: MacOS
Python version: 3.8.6
datamodel-code-generator version: 0.13.1
Additional context
N/A
The text was updated successfully, but these errors were encountered:
Describe the bug
If multiple properties use the same $ref, with one of those properties having the same name as the $ref, the generated code fails mypy checks with a [name-defined] error.
To Reproduce
Example schema:
identifier.json
:example.json
:Generated code:
identifier.py
:example.py
:Used commandline:
Expected behavior
I would expect the generated code to pass mypy checks with no errors. Since the error appears to be caused by the
from . import identifier
import, changing this to befrom . import identifier as identifier_
would work.Version:
Additional context
N/A
The text was updated successfully, but these errors were encountered: