Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I only want routing for v1. any other integer version should 404.
Currently I can pass through any integer and get back data as if it was calling v1.
ex) GET https://somedomain/app/api/v25/resouce/641B3CAA-1229-4AC2-BA9A-73534B7E9D4C
returns the same as https://somedomain/app/api/v1/resouce/641B3CAA-1229-4AC2-BA9A-73534B7E9D4C
Expected Behavior
only v1 should hit my v1 controller. v25, v2, v8, etc should all 404.
Steps To Reproduce
using fairly boiler plate setup
in startup:
private void ConfigureApiVersioning(IServiceCollection services)
{
services
.AddApiVersioning(options =>
{
options.ReportApiVersions = true;
})
.AddApiExplorer(options =>
{
options.DefaultApiVersion = new ApiVersion(1, 0);
const string groupNameFormat = "'v'VVV";
options.GroupNameFormat = groupNameFormat;
options.SubstituteApiVersionInUrl = true;
});
}
In my controller:
[ApiVersion("1.0")]
[Route("v{api-version:apiVersion}/someResource")]
[Produces("application/json")]
[Consumes("application/json")]
public class SomeController
Exceptions (if any)
No response
.NET Version
8.0.300
Anything else?
No response