Swashbuckle.AspNetCore icon indicating copy to clipboard operation
Swashbuckle.AspNetCore copied to clipboard

Route parameters not used correctly?

Open RobThree opened this issue 2 years ago • 4 comments

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?

RobThree avatar Dec 14 '22 14:12 RobThree

Is that ObjectId from MongoDb? I believe it has changed rather than swashbuckle?

Havunen avatar Apr 14 '24 06:04 Havunen

Please provide a minimal reproducible example as a GitHub repository that demonstrates the issue you're experiencing so we can look into this further.

martincostello avatar Apr 14 '24 10:04 martincostello

This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.

github-actions[bot] avatar Jun 14 '24 01:06 github-actions[bot]

Hi @RobThree. This seems to be the same issue as #2921. Can you please close this as completed and see the swagger-ui issue linked?

jgarciadelanoceda avatar Jun 18 '24 17:06 jgarciadelanoceda

This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.

github-actions[bot] avatar Aug 22 '24 01:08 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Sep 05 '24 01:09 github-actions[bot]