Issue while trying to upload a file using swagger editor

462 views
Skip to first unread message

prabim manandhar

unread,
Apr 22, 2016, 3:17:46 AM4/22/16
to Swagger
We are using the swagger editor (http://editor.swagger.io/#/) for documenting the api created using flask python. In our api documentation, we are facing an issue while uploading the file through swagger.

We are using the following line in my yaml file in swagger for upload

      parameters:
        - name: file
          in: formData
          description: "file to upload"
          required: false
          type: file
      consumes:
        - multipart/form-data
      produces:
        - application/json

It doesn't seems to be working. Our flask API is handling the file upload request as follow
      file_upload = request.files['file']
It is checking the files object sent in the request. The problem is while sending the request using the swagger, the value of "request.files" is returned empty.

Can someone please share their suggestions on how we can make it work?

Ron Ratovsky

unread,
Apr 22, 2016, 3:50:10 AM4/22/16
to swagger-sw...@googlegroups.com
How are you uploading the file?

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

prabim manandhar

unread,
Apr 22, 2016, 4:13:31 AM4/22/16
to Swagger
We have created the yaml file using online http://editor.swagger.io/#/ and we are uploading our file using the input field created in the corresponding UI part.

Ron Ratovsky

unread,
Apr 22, 2016, 5:02:56 AM4/22/16
to swagger-sw...@googlegroups.com
That’s a known issue with the editor - https://github.com/swagger-api/swagger-editor/issues/599.

Reply all
Reply to author
Forward
0 new messages