ARTICLE AD BOX
As the title goes I'm trying to create a DTO object like this:
public class RequestDto { [FromHeader] public string correlationId; [FromRoute] public string Id { get; set; } [FromQuery] public string Status { get; set; } }and when I use it as follows
[HttpGet("{id}/enrollments")] public async Task<IActionResult> GetEnrollments(RequestDto request){...}and try to test the endpoint by populating through swagger the curl keeps generating as:
curl -X 'GET' \ 'http://localhost:8080/{id}/entrollments?Status=Enrolled' \ -H 'accept: text/plain' -H 'x-correlation-id: 12343'response
{ "errors":{ "id":"{id}", "message":"id not found" } }The literal string "{id}" is being populated in the Id field. And It works fine when the request is sent through insomnia or postman or using a curl like
curl -X 'GET' \ 'http://localhost:8080/1234/enrollments?Status=Enrolled' \ -H 'accept: text/plain'response
{ "id":"1234" "entrollments":[ "TEST-1" ] }Why does the Swagger UI keep generating incorrect url?
Is it not recommended to have multiple binding attribute in a common complex class even if its single usage of each binding attribute?
Is there any inconsistency in behavior when a request DTO has multiple source bindings?
