Skip to content
GitLab
    • Explore Projects Groups Snippets
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
  • #11256
Closed
Open
Issue created 3 years ago by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items
  • New related issue

  • Report abuse to administrator

  • New related issue

  • Report abuse to administrator

[BUG][JAVA] request body parameter with explode=true need to generate separate parameters for each value of the array

Open

[BUG][JAVA] request body parameter with explode=true need to generate separate parameters for each value of the array

Created by: ynojima

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
openapi: "3.0.0"
info:
  version: 1.0.0
  title: Example API
paths:
  /translate:
    post:
      operationId: translate
      summary: Translate text
      requestBody:
        content:
          application/x-www-form-urlencoded:
            encoding:
              text:
                explode: true
                style: form
            schema:
              type: object
              properties:
                text:
                  type: array
                  items:
                    type: string
      responses:
        '200':
          description: translations
        default:
          description: error

The code generated from the above spec should yield following request. expected request(values form separate parameters:

curl -X 'POST' \
  'https://example.com/translate' \
  -H 'accept: */*' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'text=string&text=string'

actual request (values are joined into one parameter):

curl -X 'POST' \
  'https://example.com/translate' \
  -H 'accept: */*' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'text=string,string'

Please refer OAS v3 Encoding object section for more details: https://swagger.io/specification/

openapi-generator version

5.3.1

OpenAPI declaration file content or url

See the example above.

Generation Details

Java API client generation

Steps to reproduce

Generate Java API client from the aboe spec, and send a request with that and check the request body of it.

Related issues/PRs

None

Suggest a fix

at least api.mustache template need to be fixed: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/api.mustache#L98

  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

No tasks are currently assigned. Use tasks to break down this issue into smaller parts.

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
1
Issue: Bug
1
Issue: Bug
    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: OpenAPITools/openapi-generator#11256

Menu

Explore Projects Groups Snippets