-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default value for collectionFormat field is csv. Should be multi. #1160
Comments
For the sake of documentation, the format is |
…uery parameters has been changed to multi
Fixes #1160: CollectionFormat default value for form and query parameters has been changed to multi
Fixed in develop_2.0. |
Can I set collectionFormat to be csv for query parameter? as my rest api is like foo=bar, baz |
yes you can |
@fehguy how do I set it? in the annotation ApiParam? |
by checking https://github.com/kongchen/swagger-maven-plugin/blob/master/src/main/java/com/github/kongchen/swagger/docgen/reader/AbstractReader.java, Line 417, it sets collectionFormat to multi for query param. |
@Armanda888 do you solve your question? have the same problem after update. |
@fehguy can you please show how we can set collectionFormat to csv through annotations + swagger plugin? |
@gkozyryatskyy what swagger plugin are you referring to? If this is springfox, then it's a separate project that may not support the latest annotations. |
@fehguy this one https://github.com/kongchen/swagger-maven-plugin |
OK looks like we need to open a ticket in that project. |
@gkozyryatskyy @fehguy This issue has nothing to do with swagger-maven-plugin but more with ParameterProcessor in swagger-core 1.5.x. Currently setting collectionFormat to csv via annotation is ignored when producing swagger json spec because io.swagger.models.parameters.AbstractSerializableParameter#setType resets collectionFormat to null after it has been set to "csv" anytime type is not array. |
Currently the default value in the field
collectionFormat
iscsv
. However the default way of passing a list of parameters ismulti
(foo=bar&foo=baz
). Talking with ron, who_ and jeremyw in #swagger/freenode this was identified as a bug.Here is the part of the code that does that ->
swagger-core/modules/swagger-jaxrs/src/main/java/io/swagger/jaxrs/ParameterProcessor.java
Line 97 in 9c67549
The text was updated successfully, but these errors were encountered: