Skip to content

Microsoft.AspNetCore.Mvc.Versioning 5.0.0 removes number from end of controller name #734

Closed
@kimsey0

Description

@kimsey0

Microsoft.AspNetCore.Mvc.Versioning 5.0.0 seems to introduce a breaking change from 4.2.0 where it removes numbers at the end of controller names when generating API descriptions and paths for them.

Reproduction steps:

  1. Create a new solution in Visual Studio using the ASP.NET Core Web API template, leaving all settings at their default values (including keeping Enable OpenAPI support checked).
  2. Rename the created WeatherForecastController class to WeatherForecastV1Controller.
  3. Install the Microsoft.AspNetCore.Mvc.Versioning NuGet package in version 5.0.0.
  4. Add services.AddApiVersioning(); after services.AddControllers(); in Startup.cs.
  5. Start debugging using the default IIS Express launch profile.

Expected results:

The Swagger UI shows one path, WeatherForecastV1, and allows calling it at `/WeatherForecastV1, which is correctly routed to the controller by ASP.NET Core (though returning a 400 status code).
ASP NET Versioning Bug 4 2 0

This behavior is seen if you install version 4.2.0 of the NuGet package above.

Actual results:

The Swagger UI shows one path, WeatherForecastV, and calls it at /WeatherForecastV, which is not correctly routed to WeatherForecastV1Controller and therefore returns a 404 status code.
ASP NET Versioning Bug 5 0 0

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions