Forum Discussion

Vilo's avatar
New Contributor
2 years ago

.NET Show deprecated route even if new version exist

On my .NET project I have different version of my ComposerController For each one, the namespace .Vx is applied for deprecated version and [ApiVersion("X", false/true)] is wrote. Example for V2 :  ...
  • Vilo's avatar
    2 years ago

    The explaination :

    Swashbuckle and Swagger only allow one unique route for each method.
    So : api/v{version:apiVersion}/composer for version 2 and api/v{version:apiVersion}/composer for version 3 are the same.

    In order to have really "api/v2/composer" and "api/v3/composer", the HttpConfiguration .NET object must to define :

    httpConfig.AddVersionedApiExplorer(o => o.SubstituteApiVersionInUrl = true);