Skip to content

[BUG][typescript-fetch] Fixed TypeScript code generation for oneOf using arrays#22780

Merged
macjohnny merged 1 commit intoOpenAPITools:masterfrom
psegalen:master
Feb 2, 2026
Merged

[BUG][typescript-fetch] Fixed TypeScript code generation for oneOf using arrays#22780
macjohnny merged 1 commit intoOpenAPITools:masterfrom
psegalen:master

Conversation

@psegalen
Copy link
Contributor

@psegalen psegalen commented Jan 22, 2026

This PR just fixes the syntax of the generated code, no opinionated new code, no change of any nature to anything, just some syntax fix.
It fixes issue #22779

Fix is only about balancing unbalanced parentheses and using the correct variables, nothing else.

Again, as this doesn't change anything about anything already functional and being in a kind of a hurry, I haven't walked through the PR checklist, sorry.


Summary by cubic

Fixed TypeScript code generation for oneOf arrays so Date and DateTime arrays parse and serialize correctly. This corrects variable usage and missing parentheses in the template.

  • Bug Fixes
    • Use item (not json) in json.every and map.
    • Balance missing parentheses in if conditions and map calls.
    • Map to new Date(value) when parsing arrays; serialize Date arrays with toISOString().substring(0,10) and DateTime arrays with item.toISOString().

Written for commit 785ecb4. Summary will update on new commits.

Copy link

@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.

No issues found across 1 file


Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

@psegalen psegalen changed the title Fixed TypeScript code generation for oneOf using arrays [BUG][TypeScript] Fixed TypeScript code generation for oneOf using arrays Jan 23, 2026
@wing328
Copy link
Member

wing328 commented Feb 2, 2026

i add some tests via #22870 and incorporate your changes in this PR but there's no change in samples (TypeScript Fetch output) and the CI tests still failed.

can you please take a look when you've time?

@wing328
Copy link
Member

wing328 commented Feb 2, 2026

cc @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04) @joscha (2024/10) for review as well

@wing328 wing328 changed the title [BUG][TypeScript] Fixed TypeScript code generation for oneOf using arrays [BUG][typescript-fetch] Fixed TypeScript code generation for oneOf using arrays Feb 2, 2026
Copy link
Member

@macjohnny macjohnny left a comment

Choose a reason for hiding this comment

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

thanks for the fix!

@macjohnny macjohnny merged commit 9591118 into OpenAPITools:master Feb 2, 2026
15 checks passed
@wing328
Copy link
Member

wing328 commented Feb 3, 2026

@psegalen given that it's now merged. can you please test the latest master to see if it's working for your use cases?

@wing328
Copy link
Member

wing328 commented Feb 5, 2026

@psegalen you can test with the snapshot version published to central maven repo e.g. https://central.sonatype.com/repository/maven-snapshots/org/openapitools/openapi-generator-cli/7.20.0-SNAPSHOT/openapi-generator-cli-7.20.0-20260204.115301-105.jar

we will cut a release next week. just want to make sure the your fix works for your use cases as expected

otherwise, we can consider reverting the change.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants