Swagger and the IHttpActionResult return type

Swagger is great for documenting APIs. Using an IHttpActionResult return type, however, means that Swagger does not know the data structure that will be returned:

The fix

Decorating the controller action method with the below ensures that Swagger is aware of the context.

[System.Web.Http.Description.ResponseType(typeof(IEnumerable<MyClass>))]

The result