pseudomuto / protoc-gen-doc

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

Add sortable ServiceMethods for template use with requisite unit tests #534

Open ericlugo opened 1 month ago

ericlugo commented 1 month ago

What is Changing?

Functionally nothing changes to existing setups. The changes I've implemented are meant to be entirely optional and access is provided through a function that can be called within the .tmpl files. Currently the Order Guarantee provides alphabetical access for a majority of the information available in a proto file but Service Methods can only be accessed in file-order. Service Methods can now optionally be fed through the SortServiceMethods function to get back an alphabetical listing.

How is it Changing?

No unorthodox implementation details were had to my knowledge. I wanted to provide the usage without modifying the default implementation so it was added as a function call. Beyond that, the needed parts are modeled after what is already there for Messages, Enums, etc...

What Could Go Wrong?

This is being tested through use in a personal project as well the added unit test in template_test.go In my opinion, there is no available risk in adding this as the default usage remains untouched and this simply adds some extra functionality which mirrors existing items.

ericlugo commented 1 month ago

ping for potential PR @estan @masterzen @glasser @sunfmin