swagger-api / swagger-api/swagger-codegen

JAVA/Swagger-codegen-maven-plugin : explode param not taken into account

Open
#10,824 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

explode option is note taken into account when generating client.

For the following operation :

"/operation/{operationId}": {
  "get": {
    "operationId": "retrieveOperationData",
    "parameters": [
      {
        "name": "allParams",
        "in": "query",
        "required": true,
        "style": "form",
        "schema": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    ],
    "responses": {
      "200": {
        "description": "OK",
        "content": {
          "*/*": {
            "schema": {
              "$ref": "#/components/schemas/ModelReturn"
            }
          }
        }
      }
    }

Api client generated with swagger-codegen-maven-plugin generates th following request:
http://localhost:7999/operation/4?allParams=%7BadditionalProp1=myString1,%20additionalProp2=myString2,%20additionalProp3=myString3%7D

Swagger-ui on api generate the correct URL:

http://localhost:7999/operation/4?additionalProp1=myString1&additionalProp2=myString2&additionalProp3=myString3

with the following allParams query parameter value :
{
"additionalProp1": "myString1",
"additionalProp2": "myString2",
"additionalProp3": "myString3"
}

Is explode param really managed?

Many thanks to all.

Swagger-codegen version

version 3.0.23

Swagger declaration file content or url

json file use for both generation:
openapi.txt

Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied OpenAPI declaration and reproduce the generated Java client request through swagger-codegen-maven-plugin version 3.0.23. Trace how the object-valued allParams query parameter is serialized, then verify that explode produces separate additionalProp query parameters rather than one encoded object value.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.