-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
What are you wanting to achieve?
I am trying to get the generated openapi json to generate my parameters decorated as [FromForm] correctly. Currently, it generates as a single object parameter as opposed to multiple parameters that can be provided.
using version 8.1.4 or greater, I get the following
As opposed to the below using an older version (eg. v6.6.2)
There was this discussion before that identified that using WithOpenApi would make it behave as I desire it to, but it doesn't work anymore, it appears that the WithOpenApi behaviour has been changed just to make it consistent. dotnet/aspnetcore#52284
Is there any way to get the previous behavior, so that I can accommodate request data and files in a single fromform described parameter.
What code or approach do you have so far?
group.MapPost("/send-email", async (
[FromServices] ISender sender, HttpContext ctx, [FromForm] PublishSendEmailRequest request) =>
{
var response = await sender.Send(request);
return Results.Ok(response);
})
.WithName("SendEmail")
.WithDescription("Sends an email")
.Accepts("multipart/form-data")
.WithOpenApi();
Additional context
No response
