OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
20.59k stars 6.29k forks source link

[BUG] Kotlin-retrofit2-gson-coroutines CollectionsFormat.CSVParams default value is set to arrayListOf() #18864

Open fvlahov opened 1 month ago

fvlahov commented 1 month ago

Bug Report Checklist

Description

Open api generator where the code generated gives parameter of type CSVParams gives wrong default implementation, it should create the CSVParams class but instead it is @Query("sort") sort: CSVParams? = arrayListOf("date:desc")

openapi-generator version

7.6.0

OpenAPI declaration file content or url
    SortSchema:
      type: array
      description: |
        ...
      default: [ 'date:desc' ]
      items:
        type: string
        pattern: '^(date|name|popularity|trend)(:(asc|desc))?$'
      example: [ 'date:desc', 'name' ]
Generation Details
        generatorName = "kotlin"
        inputSpec = "$rootDir/data/src/main/assets/openapi/${spec.value}"
        outputDir = "$buildDir/generated/openapi"
        configOptions = [
                dateLibrary         : "java17",
                library             : "jvm-retrofit2",
                serializationLibrary: "gson",
                useCoroutines       : "true"
        ]
        nameMappings = [
                "identifier": "id"
        ]
        modelNamePrefix = "Api"
        apiNameSuffix = "Api"
        generateModelTests = false
        generateApiTests = false
Steps to reproduce
Related issues/PRs
Suggest a fix

Default value of CSVParams should create an instance of CSVParams class instead of ArrayList