parameters defined in docstrings are always set to required in open api JSON
Boneill3 opened this issue · comments
Brian ONeill commented
When I indicate a parameter as not required, it is always being set to required. Below is the docstring I am using and below that is the json that is generated. I get the same result if I remove required as well. Is this expected?
Thank you!
Docstring
"""
Return all orders for the current user
---
get:
summary: Display all orders with provided parameters
security:
- cookieAuth: []
parameters:
- in: path
name: search
required: false
schema:
type: string
description: A search string to be applied across all fields
- in: path
name: page
required: false
schema:
type: integer
description: Page number. (Each page contains 10 items)
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
type: object
401:
description: Access token cooke is not provided or not valid
content:
application/json:
schema: MessageSchema
"""
Generated JSON
"get": {
"parameters": [
{
"description": "A search string to be applied across all fields",
"in": "path",
"name": "search",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "Page number. (Each page contains 10 items)",
"in": "path",
"name": "page",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"items": {
"type": "object"
},
"type": "array"
}
}
},
"description": "OK"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Message"
}
}
},
"description": "Access token cooke is not provided or not valid"
}
},
"security": [
{
"cookieAuth": []
}
],
"summary": "Display all orders with provided parameters"
}
},
I am using the following plugins: FlaskPlugin, MarshmallowPlugin
Brian ONeill commented
Path parameters are always required, these parameters should have been defined as in: query.