You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Routes that accept both form and json bodies through multiple controller actions with [ConsumesAttribute], a documented, supported use case of aspnetcore, are not emitted correctly by Microsoft.AspNetCore.OpenApi.
is overwriting operations that have the same HTTP verb and path but differ by content type. It should be merging the operations when there's an existing item in operations that only differs by having different request body content types.
ascott18
added a commit
to ascott18/AspNetCore
that referenced
this issue
Apr 8, 2025
Is there an existing issue for this?
Describe the bug
Routes that accept both form and json bodies through multiple controller actions with [ConsumesAttribute], a documented, supported use case of aspnetcore, are not emitted correctly by Microsoft.AspNetCore.OpenApi.
The comment on these lines is incorrect:
aspnetcore/src/OpenApi/src/Services/OpenApiDocumentService.cs
Lines 478 to 480 in 44a9f8a
Expected Behavior
Both JSON and form content types are listed for the endpoint in
requestBody.content
in the OpenAPI document.Steps To Reproduce
Write the exact example from the [Consumes] documentation at https://learn.microsoft.com/en-us/aspnet/core/web-api/?view=aspnetcore-9.0#define-supported-request-content-types-with-the-consumes-attribute-1:
Observe that the JSON body is excluded from the OpenAPI document produced by
Microsoft.AspNetCore.OpenApi
. Only the form data body is present:Exceptions (if any)
No response
.NET Version
9.0.100-rc.2.24474.11
Anything else?
No response
The text was updated successfully, but these errors were encountered: