Skip to content

How should I handle generating for "remote" Protobuf definitions? #1112

Answered by doriable
doriable asked this question in Q&A
Discussion options

You must be logged in to vote

If the external Protobuf definitions do not have any dependencies, the most simple solution is to use the --config flag and target the external Protobuf definitions:

Example:

$ buf generate https://github.com/<external_owner>/<external_repo>.git#subdir=proto --config '{"version": "v1"}'

If the external Protobuf definitions do have dependencies, then we'll need to use a workaround involving Buf Workspaces.

In your buf.work.yaml, add your external Protobuf definition target and their dependencies. As an example, the let's say you're adding external Protobuf definitions that have protoc-gen-validate and googleapis as dependencies:

version: v1
directories:
  - <external_repo_dir>/proto # you…

Replies: 1 comment

Comment options

doriable
May 6, 2022
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by doriable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant