Skip to content

Add logic and test case to avoid stackOverflow exception for circular allOf#23968

Open
ainGitHub wants to merge 2 commits into
OpenAPITools:masterfrom
ainGitHub:fix_issue_23966
Open

Add logic and test case to avoid stackOverflow exception for circular allOf#23968
ainGitHub wants to merge 2 commits into
OpenAPITools:masterfrom
ainGitHub:fix_issue_23966

Conversation

@ainGitHub
Copy link
Copy Markdown

@ainGitHub ainGitHub commented Jun 7, 2026

To fix issue #23966

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Prevents StackOverflow for circular allOf and fixes sibling allOf handling in example generation. Examples now generate correctly without infinite recursion.

  • Bug Fixes
    • Detect circular $ref in allOf within ExampleGenerator and skip revisiting processed models (warn instead of recursing); correctly traverse non-$ref allOf entries and isolate processed tracking per $ref.
    • Added tests: generateFromResponseSchemaWithAllOfCircularSchema and generateFromResponseSchemaWithAllOfSiblingSchema, plus schemas ExampleAllOfCircularSchema, ExampleAllOfSiblingSchema, ExampleAllOfSiblingContainerSchema and new paths to validate behavior.
    • Fixes [BUG][JAVA] StackOverflowError in ExampleGenerator due to circular allOf references #23966.

Written for commit d60cec5. Summary will update on new commits.

Review in cubic

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][JAVA] StackOverflowError in ExampleGenerator due to circular allOf references

1 participant