Repository navigation
[kotlin] Fix inline enum array parameter default values - #24940
Merged
wing328 merged 1 commit intoSep 14, 2026
Merged
Conversation
An array parameter with inline enum items and a default was rendered as an
enum class reference that does not exist for operation parameters, and the
jvm-ktor client then mangled it further into an invalid identifier.
Parameter defaults for such arrays now use the plain item values, e.g.
setOf("red","blue"), which fixes jvm-ktor, jvm-volley and javalin5/6.
Fixes OpenAPITools#24851
Member
|
thanks for the pr i was able to repeat the issue and confirmed the fix. |
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 #24851. An array parameter with inline enum items and a default was rendered with an enum class that doesn't exist for operation parameters, and jvm-ktor then mangled it into something like
Set<Colors>.setOfLeft_Parenthesis.... Parameter defaults for these arrays now use the plain item values (setOf("red","blue")), which fixes jvm-ktor, jvm-volley and kotlin-server javalin5/javalin6; arrays of referenced enums keepColor.RED. I added tests in KotlinClientCodegenApiTest and KotlinServerCodegenTest that fail without the change, and ran all tests underorg.openapitools.codegen.kotlin(565 run, 0 failures). The enum-typed client libraries (okhttp4, vertx, spring, multiplatform, retrofit2) still renderColorsGetItems.setOf(red,blue)for this case through their templates, which is left for a separate change.PR checklist
bin/configs/kotlin*.yaml(124 configs); no sample output changed.cc @karismann @Zomzog @andrewemery @4brunu @yutaka0m @stefankoppier @e5l
Summary by cubic
Fixes inline enum array parameter defaults so they render plain item values instead of referencing a nonexistent enum class.
setOf("red","blue"); referenced enum items keepColor.RED.Written for commit 0421d71. Summary will update on new commits.