Closed
Description
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:
- 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).
- Rename the created
WeatherForecastController
class toWeatherForecastV1Controller
. - Install the
Microsoft.AspNetCore.Mvc.Versioning
NuGet package in version 5.0.0. - Add
services.AddApiVersioning();
afterservices.AddControllers();
inStartup.cs
. - 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).
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.