It looks like #500 introduced a bug which reports that the function arguments weren't defined when they in fact were.
Function arguments with proper definitions should not produce warnings.
Function arguments with proper definitions do produce warnings.
Consider the following swagger spec:
swagger: "2.0"
basePath: "/v1"
schemes:
- "https"
paths:
/photo:
post:
summary: "Upload a photo along with its metadata"
description: ""
operationId: "upload.upload_photo"
consumes:
- "multipart/form-data"
produces:
- "application/json"
parameters:
- name: "photo"
required: true
in: "formData"
type: "file"
description: "The photo file"
- name: "imageId"
required: true
in: "formData"
type: "string"
description: "The UUID assigned to this photo"
- name: "associations"
required: true
in: "formData"
type: "array"
collectionFormat: "csv"
items:
type: "string"
description: "A CSV list of QR IDs associated with the photo"
- name: "takenAt"
required: true
in: "formData"
type: "string"
description: "ISO 8601 compliant datetime stamp representing when the photo was taken"
- name: "latitude"
in: "formData"
type: "number"
description: "Latitude portion of where the photo was taken"
- name: "longitude"
in: "formData"
type: "number"
description: "Longitude portion of where the photo was taken"
responses:
201:
description: "Photo was uploaded and metadata stored successfully"
409:
description: "Photo with that ID already exists"
and the following Python code:
import connexion
def upload_photo(photo, imageId, associations, takenAt, latitude, longitude):
print(locals())
app = connexion.App(__name__, specification_dir="spec")
app.add_api("v1.yml")
app.run(port=8080)
When running on version 1.1.14 the command line output simply lists the locals() output and a POST:
* Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
{'latitude': 34234.32432434, 'associations': ['aaaa%2Cbbbb%2Ccccc'], 'takenAt': 'dsfdsfdsfsdffdsf', 'longitude': 324324.4444444, 'photo': <FileStorage: 'someimage.png' ('image/png')>, 'imageId': 'abcdef12345678'}
127.0.0.1 - - [04/Oct/2017 14:35:36] "POST /v1/photo HTTP/1.1" 200 -
However, when running on version 1.1.15:
* Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
Function argument 'imageId' not defined in specification
Function argument 'latitude' not defined in specification
Function argument 'longitude' not defined in specification
Function argument 'takenAt' not defined in specification
Function argument 'associations' not defined in specification
{'longitude': 324324.4444444, 'takenAt': 'dsfdsfdsfsdffdsf', 'associations': ['aaaa%2Cbbbb%2Ccccc'], 'imageId': 'abcdef12345678', 'latitude': 34234.32432434, 'photo': <FileStorage: 'someimage.png' ('image/png')>}
127.0.0.1 - - [04/Oct/2017 14:36:19] "POST /v1/photo HTTP/1.1" 200 -
Output of the commands:
python --version - Python 3.5.2pip show connexion | grep "^Version\:" - Version 1.1.15As a side note - the associations parameter doesn't seem to get split properly. Am I doing something wrong?
Thanks for reporting this issue, can you create a PR with a test to reproduce the problem (does not necessarily need to contain the fix yet)?
@flyte @hjacobs I checked #500 and found that there's a small bug which managed to get through the PR review.
I'll fix this, since I was the one reviewing :)
Most helpful comment
@flyte @hjacobs I checked #500 and found that there's a small bug which managed to get through the PR review.
I'll fix this, since I was the one reviewing :)