Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

operationId support added #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions Nancy.Metadata.Swagger/Fluent/SwaggerEndpointInfoExtensions.cs
Expand Up @@ -5,6 +5,7 @@
using Nancy.Metadata.Swagger.Model;
using Newtonsoft.Json.Schema;
using Newtonsoft.Json.Schema.Generation;
using System.Linq;

namespace Nancy.Metadata.Swagger.Fluent
{
Expand Down Expand Up @@ -83,6 +84,20 @@ public static SwaggerEndpointInfo WithRequestModel(this SwaggerEndpointInfo endp
return endpointInfo;
}

public static SwaggerEndpointInfo WithTags(this SwaggerEndpointInfo info, IEnumerable<string> tags)
{
info.Tags = tags.ToArray();

return info;
}

public static SwaggerEndpointInfo WithMethodName(this SwaggerEndpointInfo info, string name)
{
info.MethodName = name;

return info;
}

public static SwaggerEndpointInfo WithDescription(this SwaggerEndpointInfo endpointInfo, string description, params string[] tags)
{
if (endpointInfo.Tags == null)
Expand Down
3 changes: 3 additions & 0 deletions Nancy.Metadata.Swagger/Model/SwaggerEndpointInfo.cs
Expand Up @@ -14,6 +14,9 @@ public class SwaggerEndpointInfo
[JsonProperty("description")]
public string Description { get; set; }

[JsonProperty("operationId")]
public string MethodName { get; set; }

[JsonProperty("responses")]
public Dictionary<string, SwaggerResponseInfo> ResponseInfos { get; set; }

Expand Down