Popeye Popeye - 4 months ago 34x
Javascript Question

How to post files in swagger?

I am using Swagger for documenting my REST Services.
1 of my service required CSV file to be upload. After specifying following properties for parameter section in JSON file I am able to get file upload option on my swagger page.

"name": "File",
"description": "The file in zip format.",
"paramType": "body",
"required": true,
"allowMultiple": false,
"dataType": "file"

But when I select a file and click on I am getting error NS_ERROR_XPC_BAD_OP_ON_WN_PROTO: Illegal operation on WrappedNative prototype object in jquery-1.8.0.min.js (line 2), its continuously processing and I am not getting any response.


finally i found answer for this, actually previously there is no support for file upload, now they updated swagger-ui.js file. You need to replace your old one with new and also you have to define these properties under Parameters for particular parameter:

 "paramType": "body",
 "dataType": "file",