Swashbuckle.AspNetCore icon indicating copy to clipboard operation
Swashbuckle.AspNetCore copied to clipboard

[Bug]: Array parameter in `multipart/form-data` does not explode when it's part of a complex object

Open FlameWolf opened this issue 3 months ago • 3 comments

Describe the bug

When the request body is multipart/form-data, and it contains an array parameter which is part of a complex object, the array parameter does not explode, but instead the value is sent as a comma-separated list.

Expected behavior

An array parameter should be sent as multiple form fields having the same name even when it is not a direct parameter of an operation but included as part of a complex object.

Actual behavior

Value of the array parameter is sent as a comma-separated list.

Steps to reproduce

  1. Clone the repo https://github.com/FlameWolf/DotNet9WebApi
  2. Comment out line #30 in Program.cs:
    options.OperationAsyncFilter<SwaggerArrayParameterFilter>();
    
  3. Run the application and try out the endpoint /WeatherForecast/post
  4. Uncomment line #30 in Program.cs to see the expected behaviour

Exception(s) (if any)

No response

Swashbuckle.AspNetCore version

7

.NET Version

9

Anything else?

No response

FlameWolf avatar Nov 23 '24 07:11 FlameWolf