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
The reason I want a combined [FromRoute] and [FromBody] is because I am using the NuGet package Ardalis.ApiEndpoints, which forces your controller's action method to only have a single argument (a request type).
With the above, Swashbuckle generates this example. Notice how the FirstName and LastName properties incorrectly come from the "path", where as it should be a response body.
Accessing the endpoint from Postman works though. If I make the following request:
PUT /users/foobar
{
"firstName": "Jonathan",
"lastName": "Peterson"
}
And place a breakpoint, the request object correctly has all values (including both the route parameter and the body parameters).
But Swashbuckle should be recognizing that the firstName and lastName are part of the body, not path parameters.
Tested using latest dotnet (6.0) and latest Swashbuckle (6.2.3) as of writing.
The reason I want a combined
[FromRoute]
and[FromBody]
is because I am using the NuGet packageArdalis.ApiEndpoints
, which forces your controller's action method to only have a single argument (a request type).Ardalis.ApiEndpoints
can be found here: https://github.com/ardalis/ApiEndpointsFor instance, consider the following code (
EndpointBaseAsync
inheritsControllerBase
and also has an[ApiController]
attribute on it):With the above, Swashbuckle generates this example. Notice how the
FirstName
andLastName
properties incorrectly come from the "path", where as it should be a response body.Accessing the endpoint from Postman works though. If I make the following request:
And place a breakpoint, the
request
object correctly has all values (including both the route parameter and the body parameters).But Swashbuckle should be recognizing that the
firstName
andlastName
are part of the body, not path parameters.Tested using latest dotnet (
6.0
) and latest Swashbuckle (6.2.3
) as of writing.More context (if interested): ardalis/ApiEndpoints#42
The text was updated successfully, but these errors were encountered: