Skip to content
This repository has been archived by the owner on Jun 3, 2023. It is now read-only.

SwaggerFormData

Jussi Saarivirta edited this page Feb 16, 2019 · 2 revisions

SwaggerFormDataAttribute

Indicates that the request body of this method contains a form multi-part key-value pair.

Example usage:

[SwaggerFormDataFile(true, "file", "Description")]
[SwaggerFormData("text", false, typeof(string), "Description")]
[SwaggerFormData("number", false, typeof(int), "Description")]
[Consumes("multipart/form-data")]
[FunctionName("MultipartFormUploadAnnotation")]
public static async Task<IActionResult> MultipartFormUploadAnnotation([HttpTrigger(
    AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req,
    ILogger log)
{
    log.LogInformation("Triggered");

    var formData = await MultipartFormReader.Read(req);
    return new OkObjectResult(formData);

}