Repository navigation
Conversation
5 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI disclosure — Codex, GPT-6 Astra (High)
Codex investigated the generator, implemented this change, wrote the regression fixture and tests, ran the local validation 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 reproducing the bug against current master, distinguishing sibling properties from union-branch properties, checking generated SDK parameter and response types, and regenerating the affected samples.
The full project test matrix and samples for unrelated generators were not run locally. The additional TypeScript checks also exposed an existing discriminator/string-enum incompatibility, described below; this PR does not claim to fix it.
Description
Closes #25635.
When an object declares properties alongside
oneOf,typescript-axiosemits only the union and drops those properties. A response such asReceipttherefore loses itsid, even though the schema requires it. Adding the field to the shared alternatives would also require it in request bodies.This change generates the union intersected with its sibling properties:
The generator's
varslist includes properties from the alternatives as well. The new template context selects only properties declared on the enclosing schema, soSubmission = LinkSubmission | TextSubmissionstays unchanged.Property and enum rendering are shared with ordinary models. Separate model files import referenced sibling types. Discriminator unions retain their existing mapping expression inside the intersection.
Regenerating all 15 Axios sample configurations changes only two
Fruitdeclarations, which now include their previously omitted optionalcolorproperty.Validation
df804ac9802fba0c51a64f8c3cb03191ed3dde2d, the four new cases fail because sibling fields are missing; the other 15 Axios tests pass.TypeScriptAxiosClientCodegenTestcases pass. The generator/core/CLI reactor package build succeeds with JDK 21:stringEnums=true, the checks for the non-discriminator request/response models pass in both layouts../bin/generate-samples.sh ./bin/configs/typescript-axios*succeeds for all 15 configurations../bin/utils/export_generator.sh typescript-axiossucceeds with no documentation changes.git diff --checkpasses.Existing limitation found during the additional compiler checks: with
stringEnums=true, the literal discriminator intersection can reduce an enum-based alternative tonever. The same failure reproduces with unmodified 7.27.0, before this change. That case is excluded from the passing string-enum compiler checks above and is outside this PR's scope.PR checklist
./mvnw clean package, regenerate samples for all generators, and export all generator documentation. These broader checks were not run locally.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.Fruitdeclarations, which now include their previously omitted optionalcolorproperty.Written for commit c457e90. Summary will update on new commits.