Store and distribute proto files in a registry #176
Closed
adamtagscherer
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hey!
This discussion is about how we could distribute some of our
APIobjects for other projects and adopters easily.Problem statement
We have the following objects
extension,locator,signature,skillandagent_recordthat is present in multiple repositories because they are needed to develop features. The problem is that there is a schema drift between these objects because there is not a single source of truth from where everyone would pull them. In this discussion I'd like to fix this issue.Requirements
protofiles so that other projects can build their services from them. The biggest problem that needs to be solved here is that theprotofile has to be present on your filesystem physically otherwise theprotoccompilation won't work.GoandPython. Other important languages can beJavaScript,TypeScriptandRustfor now.Possibilities for distribution:
protofiles in aGitHubrepo and include it as a submodule to other repos.protofiles to other repos.Possible solutions
In this section I'd like to bring up some possible solutions for this. The main idea is that these objects should be stored in
OASFrepository because they belong here.Generate with a chain of software
I created a PR with it that I've closed as of now: #168. In this PR's description I explained why I think this is a bad solution.
TLDR:
JSON Schema 07is for validating other objects against it, not for generating other formats from it. We can't express everything in aJSONschema file that we need in aprotofile. The semantics is lost in the transformation chain. Very error prone, and a lot of extra unnecessary complexity.Not to talk about the fact that it doesn't solve the distribution of the
protofiles and language bindings.Write our own generator
It can be a good idea that we write a generator that creates
protofiles from ourJSONfiles that we store on the server. Although it would need a lot of work, it might be able to serve out needs but again it doesn't solve the distribution problem. In the future if we'll have 100APIobjects that are changing frequently it might worth it to write a generator, but for now it's overkill.Manage the
protofiles manually and distribute themThere is a drawback to this approach is that we need to manually manage the parity between the
JSONfiles and theprotofiles. I think for now it's not a problem because they don't change that frequently and there is 5 of them.The pros for this solution is that we can use
protofiles as our starting schema and generate everything that we need, as usually people do. In thedirectoryrepository we already usebufbuildas a tool that generates the messages, services and language bindings for theprotofiles.buf has a registry called BSR that is built in their tooling that we can use to distribute our
protofiles. We upload theprotofiles there and it will generate the language bindings automatically, that we can download with the language's respective package manager. Theprotofiles can be used in another project'sprotobuilds ifbufCLI is used.I investigated some other registry options but none of them was as good as
BSRis for us.Conclusion
I think we should start using
BSRas aprotofile registry and start distributing ourprotofiles and lanuage bindings with it. We need an org where we can create the repos. @sriaradhyula any chance you can help us provision anagntcyorg that we can start using?All reactions