Swashbuckle.AspNetCore
Swashbuckle.AspNetCore copied to clipboard
Route parameters not used correctly?
This works:
[HttpGet("{id}")]
public Task<ConnectionProductDTO> GetAsync(long id, CancellationToken cancellationToken = default)
=> _connectionproductservice.GetAsync(id, cancellationToken);
Request URL: https://localhost:5001/api/v1/foo/907306994157748224
This doesn't:
[HttpGet("{id}")]
public Task<ConnectionProductDTO> GetAsync(ObjectId id, CancellationToken cancellationToken = default)
=> _connectionproductservice.GetAsync(id, cancellationToken);
Request URL: https://localhost:5001/api/v1/foo/{id}?id=907306994157748224
Note the {id}?id=... in the above url.
The only difference is long
vs ObjectId
in the controller method. I am still git-bisecting and figuring out what changed; but this did work a year ago. The ObjectId
can be (implicitly) cast from/to a long.
Oh, I also tried adding [FromRoute]
to the argument to no avail.
Has something changed?
Is that ObjectId from MongoDb? I believe it has changed rather than swashbuckle?
Please provide a minimal reproducible example as a GitHub repository that demonstrates the issue you're experiencing so we can look into this further.