Swagger 2.0 supports the collectionFormat
parameter. From the documentation:
Determines the format of the array if type array
is used. Possible values are:
csv
: comma separated values: foo,bar
ssv
: space separated values: foo bar
tsv
: tab separated values: foo\tbar
pipes
: pipe separated values: foo|bar
multi
: corresponds to multiple parameter instances instead of multiple values for a single instance foo=bar&foo=baz
. This is valid only for parameters in "query" or "formData".
Default value is csv
.
An example of use can be seen on the documentation:
{
"get": {
"description": "Returns pets based on ID",
"summary": "Find pets by ID",
"operationId": "getPetsById",
"produces": [
"application/json",
"text/html"
],
"responses": { ... }
},
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of pet to use",
"required": true,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv"
}
]
}