pseudomuto / protoc-gen-doc

Documentation generator plugin for Google Protocol Buffers
MIT License
2.66k stars 463 forks source link

Include file reference to types #522

Open TristanFloch opened 1 year ago

TristanFloch commented 1 year ago

This PR builds on top of https://github.com/pseudomuto/protoc-gen-doc/pull/492 (which is approved but not yet merged). The later supports splitting the generated documentation into separate files. But when files import each other, the template has no way to know in which file a particular message is defined.

This PR adds the TypeFile member to MessageField template objects, a string designing the file where the type is originally defined. Likewise for Request and Response types in ServiceMethods.

Those attributes allow templates to craft cross file links to type definitions.

Since this impacts performance, it is only enabled when the separate_files option is enabled. If separate_files is disabled or the type has no particular file (literal types for instance), the TypeFile field will be empty.

TristanFloch commented 1 year ago

Pinging @pseudomuto as suggested in contributing guidelines :slightly_smiling_face: