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
Model is created. For the keys starting with a number there should be a underscore "_" added at the beginning of the string.
Current behavior
An error is thrown:
Traceback (most recent call last):
File "/home/flz/.local/share/virtualenvs/modelCreate-nvqMaMoH/lib/python3.6/site-packages/datamodel_code_generator/__main__.py", line 122, in main
validation=namespace.validation,
File "/home/flz/.local/share/virtualenvs/modelCreate-nvqMaMoH/lib/python3.6/site-packages/datamodel_code_generator/__init__.py", line 179, in generate
result = parser.parse()
File "/home/flz/.local/share/virtualenvs/modelCreate-nvqMaMoH/lib/python3.6/site-packages/datamodel_code_generator/parser/base.py", line 317, in parse
body = format_code(body, self.target_python_version)
File "/home/flz/.local/share/virtualenvs/modelCreate-nvqMaMoH/lib/python3.6/site-packages/datamodel_code_generator/format.py", line 26, in format_code
code = apply_black(code, python_version)
File "/home/flz/.local/share/virtualenvs/modelCreate-nvqMaMoH/lib/python3.6/site-packages/datamodel_code_generator/format.py", line 46, in apply_black
string_normalization=not config.get("skip-string-normalization", True),
File "/home/flz/.local/share/virtualenvs/modelCreate-nvqMaMoH/lib/python3.6/site-packages/black.py", line 725, in format_str
src_node = lib2to3_parse(src_contents.lstrip(), mode.target_versions)
File "/home/flz/.local/share/virtualenvs/modelCreate-nvqMaMoH/lib/python3.6/site-packages/black.py", line 836, in lib2to3_parse
raise exc from None
black.InvalidInput: Cannot parse: 5:5: 1_Step: str = Field(..., alias='1 Step')
Version:
OS: Ubuntu 20.04
Python Verison: 3.6.11
datamodel-code-generator Version 0.5.13
Additional context
I think in Python variable names must not start with a number.
The text was updated successfully, but these errors were encountered:
Its me again and I have a new crazy JSON here.
Sometimes I have JSON which contains a key starting with a number.
To Reproduce
Example JSON:
Used commandline:
Expected behavior
Model is created. For the keys starting with a number there should be a underscore "_" added at the beginning of the string.
Current behavior
An error is thrown:
Version:
Additional context
I think in Python variable names must not start with a number.
The text was updated successfully, but these errors were encountered: