rest - Specify an array of strings as body parameter in swagger API -


i post array of strings like

[   "id1",   "id2" ] 

to swagger based api. in swagger file, have lines:

paths:   /some_url:     post:       parameters:         - name: ids           in: body           required: true 

what correct way specify type of ids array of strings?

update:

according specification, following should work in option:

  parameters:     - in: body       description: xxx       required: true       schema:         type: array         items:           type: string 

https://github.com/yelp/swagger_spec_validator not accept , returns long list of convoluted errors, code expects $ref.

your description of array of string correct, parameter definition misses name property valid.

here's full working example:

swagger: "2.0"  info:   title: dummy title   version: 1.0.0  paths:   /path:     post:       parameters:         - in: body           description: xxx           required: true           name: name           schema:             type: array             items:               type: string       responses:         default:           description: ok 

try online editor check openapi (fka. swagger) specs: http://editor.swagger.io/


Comments