fix(typescript-axios): preserve sibling properties in oneOf models #25636
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 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.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #25636"
general
weight: 0.35
thekhegay
<details>
<summary>AI disclosure — Codex, GPT-6 Astra (High)</summary>
Codex investigated the generator, implemented the change and review follow-up, wrote the synthetic fixtures and regression tests, ran the local checks below, and drafted this PR. I supplied the problem, requested an upstream fix, and asked for alignment with the project's contribution requirements.
The work included distinguishing enclosing constraints from union-branch fields, checking generated SDK parameter and response types, and exercising request serialization and response handling. The checks also exposed the pre-existing discriminator/string-enum limitation documented below.
</details>
Description
Closes #25635.
When an object declares properties alongside
oneOf,typescript-axiosemits only the union and drops those properties. A response such asReceiptloses its requiredid; adding that field to the shared alternatives would incorrectly require it in request bodies.This change intersects the union with the enclosing schema's properties:
Only enclosing properties enter the intersection. Plain unions and branch-only properties retain their existing behavior. Ordinary models and the intersection share property/enum rendering, and separate model files import referenced sibling types.
An enclosing
required: [id]also constrains presence when it has no siblingproperties. This produces(LinkSubmission | TextSubmission) & { 'id': unknown }: the field becomes required while each branch retains its own field type.Import selection uses the complete imports list whenever the model has
oneOf, including whenhasAllOfis also set. A direct template regression verifies that both parent and branch imports appear exactly once. This is a defensive template fix, not new end-to-end support for mixedallOf/oneOf: current schema processing can discard that combination before rendering.Validation
./mvnw -B package -Dmaven.javadoc.skip=truesucceeds with JDK 21: 5,886 tests, zero failures/errors, 18 skipped. All 20 Axios tests pass.stringEnums=true, the non-discriminator contracts pass in both layouts.Fruitdeclarations that now include their optional siblingcolor.git diff --checkpasses.Existing limitation: with
stringEnums=true, literal discriminator intersections can reduce an enum-based alternative tonever. This reproduces with unmodified 7.27.0 and is excluded from the passing string-enum type-contract checks. Runtime checks compile the generated SDK itself in all four combinations.PR checklist
./bin/generate-samples.sh ./bin/configs/*.yamland inspect the diff../bin/utils/export_docs_generators.sh.<!-- This is an auto-generated description by cubic. -->
---
Summary by cubic
Fixes
typescript-axiosdropping properties declared alongsideoneOf, so types likeReceiptno longer lose theirid,state,owner, andnotefields. The generated union is now intersected with the enclosing schema's properties:Closes #25635.
Details
oneOfunions likeSubmissionstay unchanged.requiredlist constrains presence even without sibling properties, producing(LinkSubmission | TextSubmission) & { 'id': unknown }.oneOfnow import their fullimportslist, so branch and sibling types appear exactly once, including whenallOfis also present.Fruitdeclarations, which now include their previously omitted optionalcolorproperty.<sup>Written for commit dfd6fa63c7e139cd834cc837595e32adaf14a8ca. Summary will update on new commits.</sup>
<a href="https://cubic.dev/pr/OpenAPITools/openapi-generator/pull/25636?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. -->