fix: allow allOf diamond under a discriminator parent #25877
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.45) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 407 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.360
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #25877"
general
weight: 0.35
thekhegay
With
legacyDiscriminatorBehavior=false(java, go, csharp...) spec from #13714 fails withStack overflow hit when looking for Type, an infinite loop starting and ending at ResponseDetails was seen.UpdateDetailsis allOfCreationDetailsandResponseDetailsis allOf both, sogetAllOfDescendantsreachesResponseDetailssecond time fromUpdateDetailsand throws, but its a diamond, not a loop. #17905 is same shapeNow repeat throws only when child is current schema or one of its allOf ancestors (real cycle), other repeats are skipped. Real cycle (
AallOf[Type, B],BallOf[A]) still throws, also when its schemas are first reached thru diferent parents. Repeat check also compares schema name now, mapping name differs from it withx-discriminator-value. Added test inDefaultCodegenTest, regenerated all samples: no changesFixes #13714
Fixes #17905
PR checklist
Commit all changed files.
<!-- This is an auto-generated description by cubic. -->
---
Summary by cubic
Fixes stack overflow when
allOfschemas form a diamond under a discriminator parent. WithlegacyDiscriminatorBehavior=false, schemas likeUpdateDetails(allOfCreationDetails) andResponseDetails(allOfboth) previously triggered the infinite-loop check even though the relationship is a diamond, not a cycle.The traversal now remembers which schema each descendant was first reached from and skips repeats reached through other parents (diamonds). It only raises the infinite-loop error when the descendant is the current schema or one of its ancestors, and
isAllOfAncestorOrSelfwalks everyallOfancestor path so real cycles (e.g.,CycleAallOfCycleB,CycleBallOfCycleA) still throw even when a schema is first reached through a different parent. The repeat check now compares schema names instead of mapping names, sincex-discriminator-valuecan differ.Fixes #13714 and #17905.
<sup>Written for commit 5e6bdfddf503ea06a5cccf0ccc105afac326b350. Summary will update on new commits.</sup>
<a href="https://cubic.dev/pr/OpenAPITools/openapi-generator/pull/25877?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->