There are two different packages that we can use to implement OpenAPI in ASP.NET Core:
- Swashbuckle: https://docs.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-2.2
- NSwag: https://docs.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-nswag?view=aspnetcore-2.2
Both of these use middleware to generate and serve the swagger.json file and allow the user interface to browse the service definition. In this section, we will discuss how to integrate NSwag into our vinyl catalog service. The following schema shows how NSwag is plugged into our ASP.NET Core service:
Let's start by adding NSwag.AspNetCore to the Catalog.API project by using the following command:
dotnet add package NSwag.AspNetCore
After that, we can proceed by combining the middleware to generate and provide the...