Skip to content

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

Open
KaannKara wants to merge 1 commit into
OpenAPITools:masterfrom
KaannKara:fix/typescript-axios-nullable-containers
Open

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

Conversation

@KaannKara
Copy link
Copy Markdown

@KaannKara KaannKara commented May 12, 2026

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.

Copy link
Copy Markdown
Contributor

@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 4 files

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