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

protoc-gen-swagger: No comments for path parameters #694

Closed
utrack opened this issue Jul 4, 2018 · 4 comments
Closed

protoc-gen-swagger: No comments for path parameters #694

utrack opened this issue Jul 4, 2018 · 4 comments

Comments

@utrack
Copy link
Contributor

utrack commented Jul 4, 2018

Currently Swagger generator loses comment description if I reference any field of an RPC request object in path.

Say, RPC is defined as

service Summator {
  rpc Sum(SumRequest) returns (SumResponse) {
    option (google.api.http) = {
                                // uncomment get or post+body or use YAML annotation
                                //get: "/v1/example/sum/{a}/{b}"
                                post: "/v1/example/sum/{a}"
                                body: "b"
    };
  }
}
// SumRequest is a request for Summator service.
message SumRequest {
  // A is the number we're adding to. Can't be zero for the sake of example.
  int64 a = 1;
  // B is the number we're adding.
  NestedB b = 2;
}

Swagger generates a method as

...
        "parameters": [
          {
            "name": "a",
            "in": "path",
            "required": true,
            "type": "string",
            "format": "int64"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/sumpbNestedB"
            }
          }
...

Param a can (and should) have a comment, but it's not pulled.

I'll try to fix it if no one gets to it sooner - it can be messy though since PathParam loses almost any info about its target field.

@frolickingferret445
Copy link

Are you sure that you are still seeing this issue? If I understand your issue correctly, I was seeing the same issue, but it disappeared when I pulled the latest version of grpc-gateway.

@utrack
Copy link
Contributor Author

utrack commented Aug 14, 2018

The issue is for v1.4.1 - there's no newer release than this one atm.

@johanbrandhorst
Copy link
Collaborator

Could you try against master? Might be time for us to cut a new release with this fix.

@johanbrandhorst
Copy link
Collaborator

A new release has been made, this should be fixed.

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

No branches or pull requests

3 participants