Search code examples
node.jsmultipartform-data

Any example for multipart/form-data request for requestModel?


I am using swagger-generator-koa library to generate swagger for my nodejs project. All of the API URL's generated by it (according to it's git readme) are working except for multipart/form-data request (as they didn't mention any example for this).

So, I tried to make a multipart/form-data request but didn't get any success, this package didn't pickup my API URL against form-data request.

Here is my request model,

{
    formData: {
        files: Joi.array()
            .items(
                Joi.binary().encoding('base64').max(2 * 1024 * 1024),
                Joi.binary().encoding('base64').max(2 * 1024 * 1024),
                Joi.binary().encoding('base64').max(2 * 1024 * 1024),
                Joi.binary().encoding('base64').max(2 * 1024 * 1024)
            ).required()
    },
    model: 'uploadFiles',
    group: "uploads",
    description: "upload files",
    excludeFromSwagger: false
}

Solution

  • Currently, there is no support in swagger-generator-koa for multipart/form-data