Store and distribute proto files in a registry #176
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
API
objects for other projects and adopters easily.Problem statement
We have the following objects
extension
,locator
,signature
,skill
andagent_record
that 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
proto
files so that other projects can build their services from them. The biggest problem that needs to be solved here is that theproto
file has to be present on your filesystem physically otherwise theprotoc
compilation won't work.Go
andPython
. Other important languages can beJavaScript
,TypeScript
andRust
for now.Possibilities for distribution:
proto
files in aGitHub
repo and include it as a submodule to other repos.proto
files 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
OASF
repository 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 07
is for validating other objects against it, not for generating other formats from it. We can't express everything in aJSON
schema file that we need in aproto
file. 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
proto
files and language bindings.Write our own generator
It can be a good idea that we write a generator that creates
proto
files from ourJSON
files 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 100API
objects that are changing frequently it might worth it to write a generator, but for now it's overkill.Manage the
proto
files manually and distribute themThere is a drawback to this approach is that we need to manually manage the parity between the
JSON
files and theproto
files. 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
proto
files as our starting schema and generate everything that we need, as usually people do. In thedirectory
repository we already usebufbuild
as a tool that generates the messages, services and language bindings for theproto
files.buf has a registry called BSR that is built in their tooling that we can use to distribute our
proto
files. We upload theproto
files there and it will generate the language bindings automatically, that we can download with the language's respective package manager. Theproto
files can be used in another project'sproto
builds ifbuf
CLI is used.I investigated some other registry options but none of them was as good as
BSR
is for us.Conclusion
I think we should start using
BSR
as aproto
file registry and start distributing ourproto
files and lanuage bindings with it. We need an org where we can create the repos. @sriaradhyula any chance you can help us provision anagntcy
org that we can start using?Beta Was this translation helpful? Give feedback.
All reactions