diff --git a/Nancy.Metadata.Swagger/Fluent/SwaggerEndpointInfoExtensions.cs b/Nancy.Metadata.Swagger/Fluent/SwaggerEndpointInfoExtensions.cs index 945136b..e51e18b 100644 --- a/Nancy.Metadata.Swagger/Fluent/SwaggerEndpointInfoExtensions.cs +++ b/Nancy.Metadata.Swagger/Fluent/SwaggerEndpointInfoExtensions.cs @@ -10,6 +10,20 @@ namespace Nancy.Metadata.Swagger.Fluent { public static class SwaggerEndpointInfoExtensions { + public static SwaggerEndpointInfo WithProduces(this SwaggerEndpointInfo endpointInfo, params string[] contentTypes) + { + endpointInfo.Produces = contentTypes.Length > 0 ? contentTypes : null; + + return endpointInfo; + } + + public static SwaggerEndpointInfo WithConsumes(this SwaggerEndpointInfo endpointInfo, params string[] contentTypes) + { + endpointInfo.Consumes = contentTypes.Length > 0 ? contentTypes : null; + + return endpointInfo; + } + public static SwaggerEndpointInfo WithResponseModel(this SwaggerEndpointInfo endpointInfo, string statusCode, Type modelType, string description = null) { if (endpointInfo.ResponseInfos == null) diff --git a/Nancy.Metadata.Swagger/Model/SwaggerEndpointInfo.cs b/Nancy.Metadata.Swagger/Model/SwaggerEndpointInfo.cs index 2f611e2..d766d5a 100644 --- a/Nancy.Metadata.Swagger/Model/SwaggerEndpointInfo.cs +++ b/Nancy.Metadata.Swagger/Model/SwaggerEndpointInfo.cs @@ -19,5 +19,9 @@ public class SwaggerEndpointInfo [JsonProperty("parameters")] public List RequestParameters { get; set; } + [JsonProperty("consumes")] + public string[] Consumes { get; set; } + [JsonProperty("produces")] + public string[] Produces { get; set; } } } \ No newline at end of file