I declared a list IFormFile:
[HttpPost]
[Route("test_file")]
public async Task<IActionResult> test_file([FromForm] IEnumerable<IFormFile> lstFile)
{
return null;
}
But swagger interpreted as a list of string and shows issue: "index0errorValue must be a string"(https://i.stack.imgur.com/9uaP1.png)
Can you help to fix this problem? Thanks a lot
EDIT: I fixed the error.
app.UseSwagger(options =>
{
//options.SerializeAsV2 = true;
options.RouteTemplate = swaggerOption.JsonRoute;
});
SerializeAsV2. I don't know how it works, but when I turned it off, it works.
You can use Consume attribute for that matter. The [Consumes] attribute in ASP.NET Core is used to specify the content types that a controller action method can consume or accept from which swagger is going to detect automatically.
For more information you can check the documentation here