pseudomuto / protoc-gen-doc

Documentation generator plugin for Google Protocol Buffers
MIT License
2.64k stars 464 forks source link

Markdown : The links for RPCs' Response messages link to the request messages instead. #369

Closed frolickingferret445 closed 6 years ago

frolickingferret445 commented 6 years ago

When using the latest version of protoc-doc-gen to generate markdown for a .proto file, the links for the response and request messages are both the same: they are both a link to the request message.

The following snippet is part of a markdown file generated by the proto file shown further below:

DeleteBookRequest

Field Type Label Description
name string The resource name of the book to be deleted, for example: "shelves/shelf1/books/book2"

DeleteBookResponse

Field Type Label Description
name string The resource name of the book deleted, for example: "shelves/shelf1/books/book2"

ExampleService

Method Name Request Type Response Type Description
DeleteBook DeleteBookRequest DeleteBookResponse Deletes a book.

Notice the links in the RPC? Look at the source:

| DeleteBook | [DeleteBookRequest](#example.DeleteBookRequest) | [DeleteBookResponse](#example.DeleteBookRequest) | Deletes a book. |

DeleteBookResponse links to DeleteBookRequest.

example.proto:

syntax = "proto3";

package example;

import "google/api/annotations.proto";

service ExampleService {
// Deletes a book.
rpc DeleteBook(DeleteBookRequest) returns (DeleteBookResponse) {
    // Delete maps to HTTP DELETE. Resource name maps to the URL path.
    // There is no request body.
    option (google.api.http) = {
      // Note the URL template variable capturing the multi-segment name of the
      // book resource to be deleted, such as "shelves/shelf1/books/book2"
      delete: "/v1/{name=shelves/*/books/*}"
    };
  }
}

message DeleteBookRequest {
  // The resource name of the book to be deleted, for example:
  // "shelves/shelf1/books/book2"
  string name = 1;
}

message DeleteBookResponse {
  // The resource name of the book deleted, for example:
  // "shelves/shelf1/books/book2"
  string name = 1;
}