Swagger is an implementation of OpenAPI specifications. In the video, I am going to walk through implementing an ASP.Net Core application. Which will use the Swagger NuGet package (Swashbuckle.AspNetCore).
I will use the package to expose the API documentation. I am also going to demonstrate the UI provided out of the box by the NuGet package.
Topics I am going to cover as a part of this video are:
1. Create and expose a Web API through Swagger UI
2. How to expose the comments in the model as well API class to the Swagger UI
3. How to show the Swagger UI at the root path fo the application
Swagger is universally used by the community for OpenAPI specifications.
Steps to follow:
NuGet Package Manager:
Install-Package Swashbuckle.AspNetCore -Version 5.1.0
Startup.cs
Inside of ConfigureServices method, call extension method AddSwaggerGen on the IServiceCollection instance to set up the Swagger with the dependency injection container.
Next, inside of the Configure method, call UseSwagger and UseSwaggerUI extension methods on the IApplicationBuilder instance. This will setup the middleware to enable swagger along with the UI.
Source code location:
Смотрите видео Swagger in ASP.Net Core (Using Swashbuckle.AspNetCore NuGet Package) онлайн без регистрации, длительностью 12 минут 07 секунд в хорошем hd качестве. Это видео добавил пользователь DotNet Core Central 23 Март 2020, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 44 тысяч раз и оно понравилось 75 людям.