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

Ignore ApiVersion parameter

Open Netclick19 opened this issue 5 years ago • 1 comments
trafficstars

Hi,

there is a way to ignore the apiversion route parameter? public IActionResult GetBike([FromRoute]ApiVersion apiVersion, [FromRoute] int id, [FromQuery] IncludeOptions<BikeDto, Bike> includeOptions)

Thank you.

Netclick19 avatar Apr 08 '20 13:04 Netclick19

The ApiVersion route parameter will already be ignored. Make sure you are using the API versioning API explorer extensions. It appears you are using ASP.NET Core, but this repo is for Web API. The ApiVersion has it's own model binder in both cases. As such, it's source is considered special. It can come from multiple places, even in the same request. You should not attempt to influence it's location by annotating where it comes from; e.g. remove [FromRoute]. The behavior is very similar to how CancellationToken works as a parameter.

commonsensesoftware avatar Oct 13 '20 15:10 commonsensesoftware