Skip to content

OpenApi extension fields causing recursion on big schemas #2800

@ahmetveburak

Description

@ahmetveburak

Describe the bug
Generator cannot process a big schema due to extension fields.
In my case, x-internalAPI is causing recursion if there are many components in the schema.

To Reproduce

Example schema:
The issue only happens with many components. I cannot share the exact one, but I tried to anonymize it.
https://gist.github.com/ahmetveburak/cd22bcd9666789b86e649e60595d9416

Used commandline:

$ datamodel-codegen --input anonymized-schema.json --input-file-type openapi --output model.py

Expected behavior
Produce schemas successfully.

Version:

  • OS: MacOS 26.1
  • Python version: 3.13.9
  • datamodel-code-generator version: 0.48.1

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