shinpou edited this page Sep 26, 2012 · 7 revisions
Clone this wiki locally

Welcome to the Swagger.Net wiki!

Getting Started

Start by inserting the following to the package manager console in a project that is using ASP.NET WebAPI.

Install-Package Swagger.Net

or install this manually through the package manager.

This will reference a dll called Swagger.Net, and add a file to your project under App_Start called SwaggerNet.cs. This is where this module's bootstrapping code is.

Go to the Properties -> Build of the WebAPI project and enable XML documentation file.

Ensure that the path of the XML document defined in the properties page matches that which is defined inside SwaggerNet.cs.

Decorate your webapi action methods with /// -comments as per these instructions:

Build the project and browse to /api/docs/controllerName so for example /api/docs/values for ValuesController.

As the return value you should see the XML documentation in JSON format ready to be used with any project capable of understanding the Swagger specification.

For further instructions, view this readme.