Fix nullable OpenAPI 3.1 container types for typescript-axios#23778
Open
KaannKara wants to merge 1 commit into
Open
Fix nullable OpenAPI 3.1 container types for typescript-axios#23778KaannKara wants to merge 1 commit into
KaannKara wants to merge 1 commit into
Conversation
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.
Fixes #19890
This updates nullable detection for OpenAPI 3.1 schemas whose
typesincludenull, then propagates that into generatedCodegenPropertyvalues. The typescript-axios model template already emits| nullwhenisNullableis 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 testgit diff --checkPR checklist
master.Summary by cubic
Fix nullable detection for OpenAPI 3.1 container schemas so the
typescript-axiosgenerator emits| nullunions for object, array, and map properties. Fixes #19890.type: ['object'|'array', 'null']as nullable viaModelUtils.isNullable, including refs and top-level.isNullabletoCodegenPropertyso existing templates output| null.validation,requirements, andsettings.Written for commit df1d446. Summary will update on new commits.