Swashbuckle is a tool for generating Swagger, the API description language, from your ASP.NET Web Api solution.
Using Swashbuckle, which provides Swagger-UI, you can create pretty living documentation of your web api, like this:
Documenting the Response
In this post I am going to show you how to document the Response, and a new way to generate some response examples.
You can specify the type of response for Swashbuckle a number of ways. Consider a simple API endpoint which returns a list of Countries:
One way of describing the response code and content for Swashbuckle is using a combination of XML comments, and the ResponseType attribute, like so:
However, this only allows for one type of response.
If your API method can return multiple types, i.e. in the case of an error, then you can use the new SwaggerResponse attribute:
The Swagger 2.0 spec allows for examples to be…
View original post 119 more words