How to integrate Swagger (Swashbuckle) in ASP.NET Core 2.0 Web API for automated help document generation
Swashbuckle — It is a tool for creating automated documentation for Web API. When integrated in API application it automatically generates a automated swagger documentation for your API which includes a UI to explore and test API operations from your codes.
Here is an example screenshot of UI which is generated for API after integrating SwashBuckle Swagger UI.
Installing and configuring Swashbuckle in ASP.NET Core 2.0 project
Installation is simple just follow these steps to get it working in minutes.
- Use package manager console and run
Install-Package Swashbuckle -Pre
Add Swashbuckle in project.json
Alternatively you can install using Package Manager in Visual studio .
Check the option Include prerelease
Search “Swashbuckle” and install version “6.0.0-beta902”
2. Now configure service in startup file of your project as shown below
3. That’s it. Documentation is integrated to your API. Now run your project and go to this URL. baseUrlOfyourAPI/api/help. This url api/help is configurable you can add your own at time of configuration.