Open vsvetoslavov opened 6 years ago
Seeing the same behavior with version 3.0.4:
compile 'io.swagger.codegen.v3:swagger-codegen:3.0.4'
compile 'io.swagger.codegen.v3:swagger-codegen-generators:1.0.4'
Any ideas on workarounds...?
This issue also affects generated PHP code.
I've fixed this through swagger-api/swagger-codegen-generators#309. Thus this should be fixed in generators:1.0.5/codegen:3.0.6.
Description
I have a REST service where one of my methods has a List query parameter, which is described with style = "form"(also default value).
Checking the OpenAPI spec here I see that by default query parameters have
form
style and for that the default forexplode
is true. Also spec states that:After generating a Java client, I noticed the following inside the generated DefaultApi.java file:
My understanding is that in this situation the conversion type should be "multi", not "csv".
Another interesting thing is that when converting parameters to CSV, the commas are not escaped, so an array of "one", "two", "I, Caesar" is converted to "one,two,I Caesar" which is wrong.
Swagger-codegen version
swagger-codegen-cli 3.0.0-SNAPSHOT
Swagger declaration file content or url
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i /home/vsvetoslavov/tmp/datavault-openapi.yaml -o /home/vsvetoslavov/tmp/dv-local-3/ -l java
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Use "multi" for arrays in query, that have form style and explode is true.