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

XML Comments don't handle parameters in complex models nicely #672

Open
ghost opened this issue Mar 3, 2016 · 1 comment
Open

XML Comments don't handle parameters in complex models nicely #672

ghost opened this issue Mar 3, 2016 · 1 comment
Milestone

Comments

@ghost
Copy link

ghost commented Mar 3, 2016

When doing XML comment documentation, it's considered desirable (and there are compiler warnings for it) to have the XML param tags match up to the actual parameters of the method. This unfortunately doesn't work well in Swashbuckle, since a complex model may be used to add more query parameters to the api:

class Model {
    int Param1;
    int Param2;
};

[HttpGet]
HttpResultMessage Action([FromUri(Name = "")] Model params) {
    /* ... */
}

In this case, the XML documentation "should" document the param params, but the documentation should be for Param1 and Param2 in the API. You can document the params:

/// <param name="Param1">This is parameter 1.</param>
/// <param name="Param2">This is parameter 2.</param>

but this violates convention and triggers compiler warnings.

My suggestion is to allow another tag to be used for parameters, like:

/// <swashParam name="Param1">This is parameter 1.</param>
/// <swashParam name="Param2">This is parameter 2.</param>

which would allow thise to be documented in a way that clearly separates them from the C# parameters.

@domaindrivendev domaindrivendev added this to the v6.0.0 milestone Mar 30, 2016
@domaindrivendev domaindrivendev modified the milestones: vNext, Backlog Sep 13, 2017
@Chris3773
Copy link

Another option would be to pull from the summary documentation from the model.

class Model {
    /// <summary>
    /// This is parameter 1.
    /// </summary>
    int Param1;

    /// <summary>
    /// This is parameter 2.
    /// </summary>
    int Param2;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants