Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #7199
Something went wrong while setting issue due date.
Closed
Open
Issue created 4 years ago by Administrator@rootContributor
  • New related issue

  • Report abuse to administrator

  • New related issue

  • Report abuse to administrator

[BUG][kotlin] Path params with type: array doesn't work

Closed

[BUG][kotlin] Path params with type: array doesn't work

Created by: nilskuhn

Description

If API contains path parameters of type array, generated client function uses toString() method on kotlin.Array which doesn't provide comma separated representation.

Generated code:

fun <function-name-generated-resp-operationId>(<my-array-param>: kotlin.Array<kotlin.String>) : kotlin.Array<MyDtoType> {
        val localVariableBody: kotlin.Any? = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
        val localVariableConfig = RequestConfig(
            RequestMethod.GET,
            "/path-part-1/{<my-array-param>}/path-part-2".replace("{"+"<my-array-param>"+"}", "$<my-array-param>"),
            query = localVariableQuery,
            headers = localVariableHeaders
        )

The problem is the string templating here ("$<my-array-param>"), which uses objects toString() method.

openapi-generator version

4.3.1

OpenAPI declaration file content or url

Path param of type array:

parameters:
        - name: <my-array-param>
          in: path
          required: true
          style: simple
          explode: false
          schema:
            type: array
            items:
              type: string
Generation Details

We are using openapi-generator-maven-plugin.

Steps to reproduce

Every API with a path parameter of type array should provide the described behaviour.

Suggest a fix

Use joinToString method:

"${<my-array-param>.joinToString(",")}"
  1. Oh no!

    You are trying to upload something other than an image. Please upload a .png, .jpg, .jpeg, .gif, .bmp, .tiff or .ico.

    Incoming!

    Drop your designs to start your upload.
Tasks
0
server returned results with length 1, expected length of 9

Linked items
0

Link issues together to show that they're related. Learn more.

Activity


Please register or sign in to reply
0 Assignees
None
Assign to
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
Due date
None
None
None
Time tracking
No estimate or time spent
Confidentiality
Not confidential
Not confidential

You are going to turn on confidentiality. Only project members with at least the Reporter role, the author, and assignees can view or be notified about this issue.

Lock issue
Unlocked
1
1 participant
Administrator
Reference: