OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[Java]
Using the io.swagger.v3.oas.annotations.Parameter annotation with Explode.FALSE and ParameterStyle.FORM does not generate URL in the correct format for query parameters
@Path("/foos")
public Response findFoos(
@Parameter(description = "filter based on foos", explode = Explode.FALSE, style = ParameterStyle.FORM)
@QueryParam("keys") List<String> foos) {
return super.findFoos(foos);
}
Description
[Java] Using the io.swagger.v3.oas.annotations.Parameter annotation with Explode.FALSE and ParameterStyle.FORM does not generate URL in the correct format for query parameters
Gives us the following URL in the generated Java client when called with this list (A,B,C) https://localhost/foos?foos=A%2CB%2CC instead of https://localhost/foos?foos=A,B,C
Commas should not be escaped in this case as the use of form/explode=false is described in https://swagger.io/docs/specification/serialization/
form | false | /users{?id} | /users?id=5 | /users?id=3,4,5 | /users?id=role,admin,firstName,Alex -- | -- | -- | -- | -- | --openapi-generator version
Version 6.2.1
OpenAPI declaration file content or url
Command line used for generation
docker run --name openapi-generator-cli -v "${PWD}:/local" openapitools/openapi-generator-cli:6.2.1 generate -i input.json -g java -o /local/out/java --additional-properties library="jersey2",dateLibrary="joda"
Steps to reproduce
Generate swagger to java, look at the generated java classes, in invokeAPI method the queryParam is always escaped.
Related issues/PRs
N/A
Suggest a fix/enhancement
Unknown