Avishaan Sethi

File Upload Using Swagger 2.0 Spec

A little information on how to edit your swagger.json document (v2) so that you can accept file uploads in NodeJS. Includes a workaround for a current bug.

I have searched far and near for how to write your Swagger doc to allow a file upload. They are usually for the "1.2" spec but sometimes they are incorrect as well.

The following snippet will allow you to send a file which will be in req.body.files.file (when using multner)

 "/v1/images": {
  . . .

Read More

Posted in: nodejsswaggerjs

December 06, 2014