Home » c# » c# – Generate Single Swagger file for versioning in asp.net core-Exceptionshub

c# – Generate Single Swagger file for versioning in asp.net core-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

We have implemented versioning in ASP.NET CORE 2.2 APIs with Swagger.
Now we have two version of swagger file generated for versions v1/v2. This approach works well with self hosted Asp.net core application.

But now if I try to import the swagger files in APIM with the help of Import-AzureRmApiManagementApi Powershell cmdlet which worked when we had v1 version. but with multiple version may be we can add another variable with v2 and import which doesn’t look like a long term solution.

Got below blog on how to implement the importing with powershell.
https://www.hakantuncer.com/2018/09/16/api-versioning-with-swagger-azure-api-management-services-and-asp-net-core-a-frictionless-devops-experience/

I was thinking is there any way to generate single swagger file which will have all versions in a single document v1/swagger.json.

How to&Answers: