swagger-api / swagger-api/swagger-codegen
JAVA/Swagger-codegen-maven-plugin : explode param not taken into account
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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