Closed jon-whit closed 2 years ago
Hey Jonathan,
you can limit to specific files:
$ buf generate --path protos/package1 --path protos/common
However, I would generally recommend to use multiple modules:
.
|-- buf.gen.yaml
|-- buf.work.yaml
`-- protos
|-- common
| |-- buf.yaml
| `-- common
| `-- c.proto
|-- package1
| |-- buf.yaml
| `-- package1
| `-- p1.proto
`-- package2
|-- buf.yaml
`-- package2
`-- p2.proto
$ buf generate protos/package1 --include-imports
Does either option work for you?
Yep! That works great. Thanks for the tips 👍
My project organizes protobufs like so:
package1
andpackage2
define gRPC service definitions and defineprotoc_gen_openapiv2
annotations. These packages import thecommon
package, which has definitions that are shared across packages.I'm trying to build OpenAPI doc for the services in
package1
andpackage2
. I want them to be two different outputs because one is customer facing and one is internally facing.What is the best way to generate OpenAPI doc by invoking the
protoc-gen-openapiv2
plugin uniquely forpackage1
andpackage2
, but not have them overlap with one another?