pseudomuto / protoc-gen-doc

Documentation generator plugin for Google Protocol Buffers
MIT License
2.59k stars 462 forks source link

Include file reference to types #521

Closed TristanFloch closed 11 months 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 12 months ago

Pinging @pseudomuto as suggested in contributing guidelines :slightly_smiling_face:

TristanFloch commented 11 months ago

Closing because I am changing ownership of my fork (creating a new PR).