-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Description
Hi all, I'm a bit new to OpenAPI and had a question revolving around nested arrays.
The documentation for OpenAPI 3.0 shows that one can create the schema for a nested array as such:
# [ [1, 2], [3, 4] ]
type: array
items:
type: array
items:
type: integer
I've tried using the Swagger Editor to create my own get request using a nested array which can be see here...
/astar/findLocalMaxiams:
get:
tags:
- A Star Search
summary: Finds Local Maximas by Elevation
description: Returns an array of local maximas throughout the terrain using
its corresponding elevations
operationId: find_maximas
parameters:
- name: elevationData
in: query
description: Elevation data
required: true
style: form
explode: true
schema:
type: array
items:
type: array
items:
type: number
responses:
"200":
description: Successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Point'
x-content-type: application/json
application/xml:
schema:
type: array
items:
$ref: '#/components/schemas/Point'
"400":
description: Invalid elevation data format
But I keep getting an error thrown that a value is not of type array thus failing to validating the type in the schema.

>>> arr = [[5, 8, 9], [1, 4, 7], [8, 8, 3]]
>>> params = {'elevationData': arr}
>>> requests.get('http://localhost:5000/astar/findLocalMaxiams', params=params).content
b'{\n "detail": "\'5\' is not of type \'array\'\\n\\nFailed validating \'type\' in schema[\'items\']:\\n {\'items\': {\'type\': \'number\'}, \'type\': \'array\'}\\n\\nOn instance[0]:\\n \'5\'",\n "status": 400,\n "title": "Bad Request",\n "type": "about:blank"\n}\n'
If someone can provide some clarification on how to properly do this or point to some documentation, I'd greatly appreciate it!
Edit: I did try wrapping the schema tags with the content tags as such...
/astar/findLocalMaxiams:
get:
tags:
- A Star Search
summary: Finds Local Maximas by Elevation
description: Returns an array of local maximas throughout the terrain using
its corresponding elevations
operationId: find_maximas
parameters:
- name: elevationData
in: query
description: Elevation data
required: true
content:
application/json:
schema:
type: array
items:
type: array
items:
type: number
But all that does is raises an expectation within the connexion library.
Metadata
Metadata
Assignees
Labels
No labels