I am getting errors when i am trying it, but i wanted to create an endpoint which accepts 2 query params and 1 body item, a list of names. When I run it in connexion but says it is an invalid specification.
/devices/list:
post:
tags: [Devices]
operationId: app.get_devices
summary: Gets a complete list of devices.
parameters:
- $ref: '#/parameters/foo-t'
- $ref: '#/parameters/bar-t'
- in: body
name: device_names
required: true
type: array
items:
type: string
description: a list of devices
...
It compiles and runs without the - in: body section. So i know the 2 parameters are good. It seems though I am having issue applying sending a json array to python.
Explicitly Returned error is:
connexion.exceptions.InvalidSpecification: {'in': 'body', 'name': 'device_names', 'required': True, 'type': 'array', 'items': {'type': 'string'}, 'description': 'A list of Device Names'} is not valid under any of the given schemas
Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^/']['properties']['post']['properties']['parameters']['items']: {'oneOf': [{'$ref': '#/definitions/parameter'}, {'$ref': '#/definitions/jsonReference'}]}
On instance['paths']['/devices/list']['post']['parameters'][2]: {'description': 'A list of Device Names', 'in': 'body', 'items': {'type': 'string'}, 'name': 'device_names', 'required': True, 'type': 'array'}
My desired endstate is that I can say:
//In javascript
$.post("devices/list", {device_names: ["a","b","c"]}, {params:{foo:1, bar:42}}).success( x => {
//...
});
# In Python3
def get_devices(foo, bar, device_names):
pass