Skip to content

URL Segment Versioned Controllers Do Not Report All API Versions #27

Closed
@commonsensesoftware

Description

@commonsensesoftware

When Web API controllers are versioned using a URL segment and the API versioning options are configured to report the supported and deprecated API versions, the complete set of API versions is not correctly reported.

For example:

[ApiVersion( "1.0" )]
[RoutePrefix( "api/v{version:apiVersion}/my" )]
public class MyController : ApiController
{
   [Route]
   public IHttpActionResult Get() => Ok();
}
[ApiVersion( "2.0" )]
[ApiVersion( "3.0" )]
[RoutePrefix( "api/v{version:apiVersion}/my" )]
public class My2Controller : ApiController
{
   [Route]
   public IHttpActionResult Get() => Ok();
}
Request Expected Result Actual Result
GET /api/v1/my api-supported-versions: 1.0, 2.0, 3.0 api-supported-versions: 1.0
GET /api/v2/my api-supported-versions: 1.0, 2.0, 3.0 api-supported-versions: 2.0, 3.0
GET /api/v3/my api-supported-versions: 1.0, 2.0, 3.0 api-supported-versions: 2.0, 3.0

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions