I'm trying to upload a file with some metadata:
Upload(IFormFile file, [FromForm]IEnumerable<MetadataValue> list)
public class MetadataValue
{
public Metadata Metadata { get; set; }
public string Value { get; set; }
}
public enum Metadata
{
Cat1,
Cat2
}
A list of MetadataValue is displayed like an array of string inputs. I was not able to determine how should I pass the data to the controller - I'm always receiving an empty collection.
Everything is working when I'm sending a request from Postman. This is handled by dot pattern/notation.
In Postman each parameter and each property of a complex object is being sent as a separate field:
curl --location --request POST 'https://localhost:44395/api/document/upload' \
--form 'file=@/C:/FilterDraft.txt' \
--form 'list[0].metadata=Cat1' \
--form 'list[0].value=ABC' \
--form 'list[1].metadata=Cat2' \
--form 'list[1].value=DEF'
How can I achieve this in Swagger UI?
How can I configure Swagger for better UI generation?
I'm using:
- .NET Core 3.1
- Swashbuckle.AspNetCore 5.5.1

