pseudomuto / protoc-gen-doc

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

Missing document for "grand" messages or enums (inner messages with embedding level more than 2) #360

Open jurnus opened 6 years ago

jurnus commented 6 years ago

I have a temp.proto like this:

message MessageA {
  optional ChildEnum type = 1;
  enum ChildEnum {
    TYPE_A = 1;
    TYPE_B = 2;
    TYPE_C = 3;
  }
}

message MessageB {
  repeated ChildMessage child = 1;
  message ChildMessage {
    optional string name = 1;
    optional GrandMessage content = 2;
    message GrandMessage {
      optional string sub_name = 1;
    }
    optional GrandEnum sub_type = 3;
    enum GrandEnum {
      TYPE_D = 1;
      TYPE_E = 2;
    }
  }
}

And I run command like /usr/local/bin/protoc --proto_path=./ --plugin=protoc-gen-doc=/root/gocode/bin/protoc-gen-doc --doc_out=markdown,temp.md:. temp.proto. In the output doc (either markdown or html), MessageB.ChildMessage.GrandEnum & MessageB.ChildMessage.GrandMessage is missing both in table of contents and in document body.

The output markdown of table of contents is like this (missing GrandMessage & GrandEnum):

## Table of Contents
- [temp.proto](#temp.proto)
    - [MessageA](#.MessageA)
    - [MessageB](#.MessageB)
    - [MessageB.ChildMessage](#.MessageB.ChildMessage)
    - [MessageA.ChildEnum](#.MessageA.ChildEnum)
- [Scalar Value Types](#scalar-value-types)

It seems to me that the recursive level (embedded level) is limited to < 3 when parsing inner messages / enums, is there any concern of infinite loop or something? Can this limitation be customized by input param? Thanks!

chuhlomin commented 6 years ago

Seems like it solved in https://github.com/pseudomuto/protoc-gen-doc/pull/350