[kotlin] Fix inline enum array parameter default values

Merged
TA
2mo ago
+111-2

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 keep Color.RED. I added tests in KotlinClientCodegenApiTest and KotlinServerCodegenTest that fail without the change, and ran all tests under org.openapitools.codegen.kotlin (565 run, 0 failures). The enum-typed client libraries (okhttp4, vertx, spring, multiplatform, retrofit2) still render ColorsGetItems.setOf(red,blue) for this case through their templates, which is left for a separate change.

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    Regenerated bin/configs/kotlin*.yaml (124 configs); no sample output changed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

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.

  • Array parameters with inline enum items and defaults now generate setOf("red","blue"); referenced enum items keep Color.RED.
  • Fixes jvm-ktor, jvm-volley, and javalin5/javalin6; enum-typed client libraries (okhttp4, vertx, spring, multiplatform, retrofit2) are left for a separate change.
  • Adds regression tests for both client and server codegen, and a new test resource spec for the case.