kongchen / swagger-maven-plugin

JAX-RS & SpringMVC supported maven build plugin, helps you generate Swagger JSON and API document in build phase.
http://kongchen.github.io/swagger-maven-plugin/
Apache License 2.0
761 stars 451 forks source link

"collectionFormat" is "csv" instead of "multi" #406

Open vicly opened 7 years ago

vicly commented 7 years ago

I'm using

My code looks like

@GET
    @ApiOperation(
            value = "Find active machines",
            response = Machine.class,
            responseContainer = "List")
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "Found machines"),
            @ApiResponse(code = 400, message = "Missing 'org'")
    })
    public List<Machine> findActiveMachines(
            @QueryParam("org") @NotNull UUID orgId,
            @QueryParam("mid") List<UUID> mids) {
            <plugin>
                <groupId>com.github.kongchen</groupId>
                <artifactId>swagger-maven-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <apiSources>
                        <apiSource>
                            <springmvc>false</springmvc>
                            <locations>my.pkg.resource</locations>
                            <schemes>http</schemes>
                            <basePath>/xyz/v1</basePath>
                            <info>
                                <title>xyz API</title>
                                <version>v1</version>
                                <description>Internal API of xyz</description>
                                <contact>
                                    <name>xyz Team</name>
                                    <email>xyz@xyz.com</email>
                                </contact>
                            </info>
                            <swaggerDirectory>${project.basedir}/src/main/swagger</swaggerDirectory>
                            <templatePath>${project.basedir}/src/main/swagger/api-doc-template/strapdown.html.hbs</templatePath>
                            <outputPath>${project.basedir}/target/generated-swagger/api-doc/dvir-api.html</outputPath>
                        </apiSource>
                    </apiSources>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

For @QueryParam("mid") List<UUID> mids, we expect collectionFormat is multi, but actual is csv.

This causes the auto-generated client code sending mid=1,2, rather than mid=1&mid=2 what we'd like.

Any workaround so to set multi, or is it a bug? Thanks.

who commented 7 years ago

@vicly Given the versions that you're using, I am not aware of a workaround. This issue has been fixed in newer versions of swagger-maven-plugin.

gkozyryatskyy commented 7 years ago

ok. now it is always "multi" instead of "csv"... Is there a way to make it back "csv"?

proshin-roman commented 7 years ago

@gkozyryatskyy Maybe issue #347 is related to your problem