Let's use the "pet store" application as example
Imagine that you can send multiple "find" requests in one. For that, you pass an array of associative arrays, which contain a list of integers
Text version:
criteria[0][status]: 1
criteria[0][tags]: 2,3
criteria[1][status]: 2
criteria[1][tags]: 4,5
POST /find HTTP/1.1Host: petstore.comContent-Type: application/x-www-form-urlencodedcriteria%5B0%5D%5Bstatus%5D=1&criteria%5B0%5D%5Btags%5D=2%2C3&criteria%5B1%5D%5Bstatus%5D=2&criteria%5B1%5D%5Btags%5D=4%2C5
How would you define that ?
I suggest the following syntax addition : adding a new property "indexType" to give the type of the keys in an array (default: integer, 0-based)
Example definition using this syntax
swagger: '2.0'info:
version: '1.0.0'title: Swagger Petstore (Simple)description: A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specificationtermsOfService: http://helloreverb.com/terms/contact:
name: Swagger API teamemail: foo@example.comurl: http://swagger.iolicense:
name: MITurl: http://opensource.org/licenses/MIThost: petstore.swagger.wordnik.combasePath: /apischemes:
- httpconsumes:
- application/jsonproduces:
- application/jsonpaths:
/pets/find:
get:
description: Returns multiple search query results at the same timeoperationId: findPetsproduces:
- application/json
- application/xml
- text/xml
- text/htmlparameters:
- name: criteriain: querydescription: search criteriarequired: truetype: arrayitems:
type: arrayindexType: searchCriteriauniqueItems: trueitems:
type: arrayitems:
type: integercollectionFormat: csvresponses:
'200':
description: pet responseschema:
type: arrayitems:
type: array$ref: '#/definitions/pet'default:
description: unexpected errorschema:
$ref: '#/definitions/errorModel'definitions:
searchCriteria:
type: stringenum:
- tags
- statuspet:
required:
- id
- nameproperties:
id:
type: integerformat: int64name:
type: stringtag:
type: stringerrorModel:
required:
- code
- messageproperties:
code:
type: integerformat: int32message:
type: string
Let's use the "pet store" application as example
Imagine that you can send multiple "find" requests in one. For that, you pass an array of associative arrays, which contain a list of integers
Text version:
How would you define that ?
I suggest the following syntax addition : adding a new property "indexType" to give the type of the keys in an array (default: integer, 0-based)
Example definition using this syntax