Skip to content

Instantly share code, notes, and snippets.

@justinyoo justinyoo/Consumes.cs Secret
Last active Jul 30, 2017

What would you like to do?
Swashbuckle Pro Tips for ASP.NET Web API #1
public class Consumes : IOperationFilter
public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription)
var attribute = apiDescription.GetControllerAndActionAttributes<SwaggerConsumesAttribute>().SingleOrDefault();
if (attribute == null)
operation.consumes = attribute.ContentTypes.ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.