Skip to content

fix: allOf cycle detection oversight#2316

Merged
mromaszewicz merged 1 commit intooapi-codegen:mainfrom
mromaszewicz:fix/1377-update
Apr 11, 2026
Merged

fix: allOf cycle detection oversight#2316
mromaszewicz merged 1 commit intooapi-codegen:mainfrom
mromaszewicz:fix/1377-update

Conversation

@mromaszewicz
Copy link
Copy Markdown
Member

PR #1377 was merged too early. This is a small follow-up tweak to make sure that #1373 is fixed properly.

seed allOf[0] ref into cycle detection to prevent stack overflow when self-ref is first

When the self-referencing $ref appears at position 0 in allOf, its ref was never added to seenSchemaRef. If s1's own AllOf contained a back-reference to itself, mergeAllOf would not detect the cycle.

Seed allOf[0].Ref into a top-level seen set that is copied into each iteration's seenSchemaRef map, closing this gap.

PR oapi-codegen#1377 was merged too early. This is a small follow-up tweak to make
sure that oapi-codegen#1373 is fixed properly.

seed allOf[0] ref into cycle detection to prevent stack overflow when self-ref is first

When the self-referencing $ref appears at position 0 in allOf, its
ref was never added to seenSchemaRef. If s1's own AllOf contained a
back-reference to itself, mergeAllOf would not detect the cycle.

Seed allOf[0].Ref into a top-level seen set that is copied into each
iteration's seenSchemaRef map, closing this gap.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mromaszewicz mromaszewicz requested a review from a team as a code owner April 4, 2026 00:43
Copy link
Copy Markdown
Member

@jamietanna jamietanna left a comment

Choose a reason for hiding this comment

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

Seems reasonable, but if we're able to get a test (or a spec) to validate the change works as expectedly that'd be ideal!

@mromaszewicz mromaszewicz merged commit cd4f5aa into oapi-codegen:main Apr 11, 2026
17 checks passed
@mromaszewicz mromaszewicz deleted the fix/1377-update branch April 11, 2026 20:25
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.

2 participants