I have this API endpoint which expects one form-urlencoded array parameter. This is the relevant Java snippet:
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.APPLICATION_JSON)
public Response addItems(@Parameter(description = "Items to add") @FormParam("items") List<Long> items) {
return service.addItems(items);
}
I can't reach the endpoint from the generated Swagger UI because of the following error:
RESTEASY003870: Unable to extract parameter from http request: javax.ws.rs.FormParam("items") value is '1%2C2%2C3'
From what I read, Swagger is making this request:
curl -X 'POST' \
'http://localhost:8080/items' \
-H 'accept: */*' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'items=1,2,3'
It looks to me that the culprit is how Swagger serializes the array: Swagger sends this items=1,2,3 while RESTEasy expect this items=1&items=2&items=3.
I've already read the relevant Swagger documentation and tried every style/explode combination, including the ones that looks to have most sense for me (style = ParameterStyle.SIMPLE, explode = TRUE which by the way should be default behavior) with no luck.
So, how should I annotate this endpoint in order to Swagger to be able to invoke it?

