Reputation: 193
I'm migrating from springfox to OpenAPI springdocs and I have to replace
@ApiImplicitParam(allowMultiple=true)
@ApiImplicitParam
is replaced with @Parameter
, but what is the OpenAPI springdoc equivalent to allowMultiple=true
?
Reference: https://springdoc.org/migrating-from-springfox.html
Upvotes: 4
Views: 4300
Reputation: 1614
You can use the below approach
Before
@ApiImplicitParam(value="Filter by type", allowableValues="typeA,typeB,typeC", allowMultiple=true)
After
@Parameter(description = "Filter by type", schema=@Schema(type="string", allowableValues={"typeA","typeB","typeC"}, defaultValue = "typeA"))
Upvotes: 1
Reputation: 296
You need to use the array param as the example below:
@Parameter(array=@ArraySchema(schema = @Schema()))
Upvotes: 0
Reputation: 1308
This answer is taken from what @tomjankes put in his comment to the question -> the answer is to add explode=Explode.TRUE
. Here's an example piece of code that worked for me:
@Parameters({
@Parameter(name = "sort", **explode = Explode.TRUE**, schema = @Schema(type = "string"), in = ParameterIn.QUERY, description = "Sort setting in the format of: property(,asc|desc). Default sort order is ascending. Multiple sort settings are supported.")
})
Upvotes: 0