Skip to content

Fix nullable OpenAPI 3.1 container types for typescript-axios - #23778

Merged
wing328 merged 1 commit into
OpenAPITools:masterfrom
KaannKara:fix/typescript-axios-nullable-containers
Jul 31, 2026
Merged

Fix nullable OpenAPI 3.1 container types for typescript-axios#23778
wing328 merged 1 commit into
OpenAPITools:masterfrom
KaannKara:fix/typescript-axios-nullable-containers

Conversation

@KaannKara

@KaannKara KaannKara commented May 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #19890

This updates nullable detection for OpenAPI 3.1 schemas whose types include null, then propagates that into generated CodegenProperty values. The typescript-axios model template already emits | null when isNullable is set, so nullable array/object/map properties now generate the expected union types.

cc @nicokoenig for typescript-axios

Tests:

  • JAVA_HOME="$(brew --prefix openjdk@17)" PATH="$(brew --prefix openjdk@17)/bin:$PATH" ./mvnw -B -ntp -pl modules/openapi-generator -am -Dtest=org.openapitools.codegen.typescript.axios.TypeScriptAxiosClientCodegenTest#generatesNullUnionsForOpenApi31NullableContainers -Dsurefire.failIfNoSpecifiedTests=false test
  • git diff --check

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work.
  • Run the full project build and sample regeneration commands from the template. Not run locally due disk constraints; this PR adds a focused regression test and does not change templates or checked-in samples.
  • File the PR against master.
  • Reference the reported issue using GitHub linking syntax.
  • Mention the relevant language/generator maintainer.

Summary by cubic

Fix nullable detection for OpenAPI 3.1 container schemas so the typescript-axios generator emits | null unions for object, array, and map properties. Fixes #19890.

  • Bug Fixes
    • Treat type: ['object'|'array', 'null'] as nullable via ModelUtils.isNullable, including refs and top-level.
    • Propagate isNullable to CodegenProperty so existing templates output | null.
    • Add a targeted test and 3.1 fixture verifying unions for validation, requirements, and settings.

Written for commit df1d446. Summary will update on new commits.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 4 files

@wing328

wing328 commented Jul 31, 2026

Copy link
Copy Markdown
Member

tested locally to confirm the fix.

thanks for the contribution.

@wing328
wing328 merged commit df2d81b into OpenAPITools:master Jul 31, 2026
15 checks passed
@wing328 wing328 added this to the 7.25.0 milestone Jul 31, 2026
@wing328 wing328 mentioned this pull request Aug 1, 2026
3 tasks
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.

[BUG][Bounty][typescript-axios] Doesn't generate an union with null when type is an array (works in Stoplight)

2 participants