Open Yogarine opened 5 years ago
according to this the defaults are
style:form explode:true
the other thing is, as it seems, the explode
param is ignored :/ https://github.com/OpenAPITools/openapi-generator/pull/3984#issuecomment-536914876
Is this issue fixed by #3984 PR?
Description
Individual query params with type
array
and nostyle
defined are incorrectly always serialized as "multi", while I believe it should be just comma-seperated.In
io.swagger.v3.parser.util.OpenAPIDeserializer.getParameter()
(~line 1411) if a property is "in"query
and of typearray
, it sets thestyle
toform
. The propertyParameter.explode
is then always set to true.This causes the
collectionFormat
to always be set tomulti
.In api.mustache the serializeCollection() call is hardcoded to allow "multi".
In the resulting url the query string is encoded like
components=0%3DProfiles%261%3DCharacters%262%3DCharacterProgressions
, but I can't imagine why an array would need to be encoded like that, since an array, according to the OpenAPI spec, should be just a list.openapi-generator version
3.3.4-SNAPSHOT
OpenAPI declaration file content or url
https://raw.githubusercontent.com/Bungie-net/api/master/openapi.json
A specific path, as example:
#/components/responses/Destiny.Responses.DestinyProfileResponse
:Command line used for generation
openapi-config.php.json:
Suggest a fix
A quick fix I use to get it to work for me is to just set the
$allowCollectionFormatMulti
param in theObjectSerializer::serializeCollection()
to false in the response function in api.mustache.But I think it needs be investigated whether the style should be set to
form
when a query param is declared asarray
. I would like to know the reasoning for this.If this was done like this for the sake of backwards compatability, then perhaps we need to add an option to control this.
@wing328 @jebentier @dkarlovi @mandrean @jfastnacht @ackintosh @ybelenko