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.

  1. Use package manager console and run
Install-Package Swashbuckle -Pre

Add Swashbuckle in project.json

"Swashbuckle": "6.0.0-beta902"

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.

Reference:

https://github.com/domaindrivendev/Swashbuckle.AspNetCore

Tech Enthusiast, Full Stack Software Engineer, Product Manager, Engineering Enterprise SaaS product

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store