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

Repeated field documentation is overwritten by fields comments #863

Closed
fahernandez opened this issue Feb 7, 2019 · 3 comments
Closed

Repeated field documentation is overwritten by fields comments #863

fahernandez opened this issue Feb 7, 2019 · 3 comments

Comments

@fahernandez
Copy link
Contributor

Bug report:

When defining repeated fields the documentation of the field is overwritten by the fields comments. For example:

// Some field comments
repeated string names = 2 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) =
    {
        description:
            "Some field description documentation."
           array: ["name1", "name2"];
    }];

After generating the swagger documentation the field comments takes precendence over the field documentation resulting in something like:

{
        "name": "names",
        "description": "Some field comments",
        "in": "query",
        "required": false,
        "type": "array",
        "items": {
             "type": "string"
         }
}

I think that the field documentation must take precedence over the field comments.

@achew22
Copy link
Collaborator

achew22 commented Feb 7, 2019

This would be a really great starter project for getting involved!

This comes from the interaction of these two pieces of code.

desc := schema.Description
if schema.Title != "" { // merge title because title of parameter object will be ignored
desc = strings.TrimSpace(schema.Title + ". " + schema.Description)
}

if protoSchema.Description != "" {
schema.Description = protoSchema.Description
}

A little bit of rejiggering in there + a new test case and I think you'd be done if you're interested.

@fahernandez
Copy link
Contributor Author

Sure, I will definitely try, thank you for taking me in the right direction!

@johanbrandhorst
Copy link
Collaborator

Closed by #863

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

3 participants