Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Nancy.Metadata.Swagger/Fluent/SwaggerEndpointInfoExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions Nancy.Metadata.Swagger/Model/SwaggerEndpointInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,9 @@ public class SwaggerEndpointInfo

[JsonProperty("parameters")]
public List<SwaggerRequestParameter> RequestParameters { get; set; }
[JsonProperty("consumes")]
public string[] Consumes { get; set; }
[JsonProperty("produces")]
public string[] Produces { get; set; }
}
}