Is there an existing issue for this?
Describe the bug
I'm using UrlSegmentApiVersionReader. If I create an API version with a status property, I get a 404 error when I try to call it (either from Swagger or directly from the browser).
Expected Behavior
The versioned API with the status label should be called as expected.
Steps To Reproduce
#!/usr/bin/env dotnet
#:sdk Microsoft.NET.Sdk.Web
#:property TargetFramework=net10.0
#:property Nullable=enable
#:property ImplicitUsings=enable
#:property PublishAot=false
#:package Asp.Versioning.Http@10.0.0
#:package Asp.Versioning.Mvc.ApiExplorer@10.0.0
#:package Asp.Versioning.OpenApi@10.0.0-rc.1
#:package Microsoft.AspNetCore.OpenApi@10.0.8
#:package Swashbuckle.AspNetCore.SwaggerUI@10.1.7
using Asp.Versioning;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddApiVersioning(options =>
{
options.ApiVersionReader = new UrlSegmentApiVersionReader();
}).AddApiExplorer(options =>
{
options.GroupNameFormat = "'v'VVV";
options.SubstituteApiVersionInUrl = true;
})
.AddOpenApi();
var app = builder.Build();
app.UseHttpsRedirection();
app.MapOpenApi().WithDocumentPerVersion();
var versionedApi = app.NewVersionedApi().ReportApiVersions();
var v1Api = versionedApi.MapGroup("/api/v{version:apiVersion}").HasApiVersion(1);
var v2Api = versionedApi.MapGroup("/api/v{version:apiVersion}").HasApiVersion(2, "preview");
v1Api.MapGet("ping", () =>
{
return TypedResults.Ok();
});
v2Api.MapGet("ping", () =>
{
// It is never called: GET /api/v2-preview/ping returns 404.
return TypedResults.Ok();
});
app.UseSwaggerUI(options =>
{
var descriptions = app.DescribeApiVersions();
foreach (var description in descriptions)
{
options.SwaggerEndpoint($"/openapi/{description.GroupName}.json", description.GroupName);
}
});
app.Run();
.NET Version
.NET 10.0.8
Anything else?
Asp.Versioning.Http version 10.0.0
Asp.Versioning.Mvc.ApiExplorer version 10.0.0
Asp.Versioning.OpenApi version 10.0.0-rc.1
Visual Studio 2026 18.6.1
Is there an existing issue for this?
Describe the bug
I'm using
UrlSegmentApiVersionReader. If I create an API version with a status property, I get a 404 error when I try to call it (either from Swagger or directly from the browser).Expected Behavior
The versioned API with the status label should be called as expected.
Steps To Reproduce
.NET Version
.NET 10.0.8
Anything else?
Asp.Versioning.Http version 10.0.0
Asp.Versioning.Mvc.ApiExplorer version 10.0.0
Asp.Versioning.OpenApi version 10.0.0-rc.1
Visual Studio 2026 18.6.1