Versioning is a crucial part of API design. It gives developers the ability to improve their API without breaking the client’s applications when new updates are rolled out. There are four main strategies we can use for versioning:
1. Version through URL
2. Version through query string
3. Version through the header
4. Version through Content-Type
Follow these below steps to add API versions into your Swagger page. Install required NuGet packages into your API project:
Microsoft.AspnetCore.Mvc.Versioning
Microsoft.AspnetCore.Mvc.Versioning.ApiExplorer
- @HeyBaldur twitter
- @HeyBaldur Github