Update on Protobuf // Buf research #4281
dave-gray101
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@mudler ,
As I mentioned a few weeks ago in #4012, I'm interested in doing a cleanup pass of our Protobuf layer. Lately, I have been investigating the Buf tool and ecosystem to see if it would be a useful asset to us.
This discussion ticket will serve as a place to store some of my findings so far - since I'd like your opinions as well.
.proto
files themselvesInitially, I encountered the tool when looking for something capable of reviewing our existing protobuf file and getting a sense of how compliant we were with standard practices. While I've used protobuf a few times and am familiar with the dos and don'ts guide, I've somehow missed the companion document API best practices in the past!
To put it bluntly,
buf lint
is extremely unhappy with our backend.proto file. We violate a number of guidelines in that document.My proposal is to migrate away from the
backend.proto
file to an improved "Backends v2" with a few important changes (potentially more to come?)Backend
service with rpc methods to get name, check health, load model, and return a list of other capabilitiesGeneration
Buf is an open source tool that provides additional tooling around protobuf, like the linting I mentioned above. It can check for breaking changes - which may be useful in the future. It can also directly handle codegen - it handles some of the preprocessing, and seems to call out to the usual protogen family of tools to spit out the actual code. The organization behind Buf provides some additional features through what they call "BSR" or Buf Schema Registry -- which seems to be free for small, open source users like us today... but we would need to be aware of the fact that they could take that away from us at some point. Depending on our level of tolerance of dependency on this outside resource (granted, we already have those for CI and hosting), I see a few paths forward in order of decreasing dependence:
buf generate
also doesn't need to use managed mode. If none of the above are palatable, I think we can use our current methods of getting protogen in place, and then just let buf call it. Again, more research needed, but this may have some benefits over option four if my preliminary research is right?buf generate
completely, and use our current generation code unmodified - even if we do modify the underlying protobuf files significantly, and use buf lint in our pipeline! It's worth noting that this section and the previous header are essentially independentBeta Was this translation helpful? Give feedback.
All reactions