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
Combination of --collapse-root-models and --field-constraints errors out:
File "/path/.venv/lib/python3.13/site-packages/datamodel_code_generator/__main__.py", line 494, in main
generate(
~~~~~~~~^
input_=config.url or config.input or sys.stdin.read(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<67 lines>...
no_alias=config.no_alias,
^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/path/.venv/lib/python3.13/site-packages/datamodel_code_generator/__init__.py", line 507, in generate
results = parser.parse()
File "/path/.venv/lib/python3.13/site-packages/datamodel_code_generator/parser/base.py", line 1415, in parse
self.__collapse_root_models(
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
models, unused_models, imports, scoped_model_resolver
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/path/.venv/lib/python3.13/site-packages/datamodel_code_generator/parser/base.py", line 1058, in __collapse_root_models
model_field.constraints = ConstraintsBase.merge_constraints(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
root_type_field.constraints, model_field.constraints
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/path/.venv/lib/python3.13/site-packages/datamodel_code_generator/model/base.py", line 90, in merge_constraints
if not issubclass(constraints_class, ConstraintsBase): # pragma: no cover
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen abc>", line 123, in __subclasscheck__
TypeError: issubclass() arg 1 must be a class
Describe the bug
Combination of
--collapse-root-models
and--field-constraints
errors out:To Reproduce
Schema https://csrc.nist.gov/schema/nvd/api/2.0/cve_api_json_2.0.schema
Used commandline:
Expected behavior
Not an error
Version:
The text was updated successfully, but these errors were encountered: