Instantly share code, notes, and snippets.

@justinyoo /Produces.cs Secret
Created Jul 30, 2017

What would you like to do?
Swashbuckle Pro Tips for ASP.NET Web API #1
public class Produces : IOperationFilter
public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription)
var attribute = apiDescription.GetControllerAndActionAttributes<SwaggerProducesAttribute>().SingleOrDefault();
if (attribute == null)
operation.produces = attribute.ContentTypes.ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment