pseudomuto / protoc-gen-doc

Documentation generator plugin for Google Protocol Buffers
MIT License
2.65k stars 465 forks source link

Extracting grpc-gateway openapi descriptions as Descriptor #435

Open ghost opened 3 years ago

ghost commented 3 years ago

I have checked in the docs and issues, didn't see this question asked by anyone else. I noticed that protoc-gen-validate is supported as one of the options on a message or field. I'm curious about adding support for protoc-gen-openapiv2 to expose OpenAPI fields to your doc tooling.

For example, I am working with a set of very large protobuf files that have put field descriptions in the grpc gateway openapi option. Here is an example:

message SomeMsg {
  int32 some_field = 1
    [
      (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
        description : "This is my field",
        default : 5,
        minimum : 0,
        maximum : 10
      }
    ];
  ;
}

I am interested in using this description field in protoc-gen-doc. I've tried several things to no avail and am curious if there is a quick solution using a template -- either the Go one or custom output (like MD or HTML).

ghost commented 3 years ago

Tangentially related to #233.