RicoSuter/NSwag

Feature Request: More support for xml comments

Open

#443 opened on Nov 23, 2016

View on GitHub
 (6 comments) (0 reactions) (0 assignees)C# (1,189 forks)batch import
help wantedproject: NSwag.SwaggerGeneration.WebApitype: enhancement

Repository metrics

Stars
 (6,291 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Hi,

I moved from SwaggerUI to Redoc because i have much space for the description and there is a lot to document.

Therefore I also like to use xml comments, because it is easier to add markup there.

I am missing xml comments in two places:

  1. Tag Description:

Usually I have a Tag = Controller model, it would be awesome to make something:

/// <summary>
/// Query and manages users.
/// 
/// Please note:
/// * Users ...
/// * Users ...
/// * Users ...
/// * Users ...
///
/// You need one of the following role: Owner, Editor, use XYZ to manage permissions.
/// </summary>
[SwaggerTags("Users")]
public class UsersController {
}

Btw: I think you should remove the "Controller" suffix from the default tag.

2. Response Codes

I Would like to have the swashbuckle solution:

/// <response code="201">Account created</response>
/// <response code="400">Username already in use</response>

As a workaround I implemented a processor that parses the result

/// <result>
/// 200 => Account created
/// 400 => Username already in use
/// </result>

But it cannot handle multiline yet.

What do you think?

Contributor guide