Skip to content

RecursionError: maximum recursion depth exceeded #2971

@slavnycoder

Description

@slavnycoder

Here's a bug report using the provided template. I've filled in the details based on your description, leaving a placeholder for the schema URL.


Describe the bug
Since version 0.42.2 of datamodel-code-generator, I'm unable to convert the schema at https://github.com/MovieLabs/OMC/blob/OMC-V-2.6/OMC-JSON/OMC-JSON-v2.6.schema.json to any type of models (e.g., Pydantic, dataclasses). The tool throws error: RecursionError: maximum recursion depth exceeded.

To Reproduce

Example schema:

url provided

Used commandline:

$ datamodel-codegen --input test_data/OMC-JSON-v2.6.schema.json --input-file-type jsonschema --output models_gen.py --output-model-type pydantic_v2.BaseModel --use-annotated --snake-case-field --reuse-model --target-python-version 3.13

Expected behavior
The command should generate Python models (e.g., Pydantic models) from the provided schema URL, as it did in versions prior to 0.42.2.

Version:

  • OS: Linux
  • Python version: 3.13
  • datamodel-code-generator version: 0.42.2 (and all later)

Additional context
The issue started specifically after upgrading to version 0.42.2. Downgrading to 0.42.1 or earlier resolves the problem. No error messages are shown in the output; the command simply produces no models.


Would you like me to adjust the commandline example for a specific output format (e.g., Pydantic V2, dataclasses) or add more details to the reproduction steps?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions