You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a monorepository with multiple APIs. I am migrating from protoc to buf for generating my gRPC, gRPC-Gateway, and openapiv2 code from my .proto files for each API. Currently, I have a root buf.worker.yaml that contains my shared libraries in my libs/proto and a buf.gen.yaml file per API that uses the same plugins, but different output paths since I want the generated code to be output relative to the API the code is being generated for. I'm not sure if this is the right approach and am looking for feedback if there is a way to control the output path to be relative to the API the code is being generated for. If I am able to do that I can create a buf.gen.api.yaml file in my root and reuse that as my template for each API if I can specify the root output to be the API the code is being generated for.
For example, I have a mono repository structure like this:
I would prefer to be able to remove the buf.gen.yaml per API and instead have a template in my root called "buf.gen.api.yaml" since the only part that is different is the output path. Then I would bbe able to use a command such as buf generate --template buf.gen.api.yaml --path apps/api-a/internal/proto --outputroot apps/api-a and then output the generated code relative to the outputroot path.
Does my current solution work or is there a way to create an approach similiar to the one above and remove the duplication buf.gen.yaml files per API since they use the same plugins and just need the output to be relative to the api the code is being generated for?
The text was updated successfully, but these errors were encountered:
This is a similar feature request to #3060, which is supporting plugin configurations on a per module/input basis, so closing as a duplicate of that issue to consolidate all discussion there.
Hey all,
I have a monorepository with multiple APIs. I am migrating from protoc to buf for generating my gRPC, gRPC-Gateway, and openapiv2 code from my .proto files for each API. Currently, I have a root buf.worker.yaml that contains my shared libraries in my libs/proto and a buf.gen.yaml file per API that uses the same plugins, but different output paths since I want the generated code to be output relative to the API the code is being generated for. I'm not sure if this is the right approach and am looking for feedback if there is a way to control the output path to be relative to the API the code is being generated for. If I am able to do that I can create a buf.gen.api.yaml file in my root and reuse that as my template for each API if I can specify the root output to be the API the code is being generated for.
For example, I have a mono repository structure like this:
I would prefer to be able to remove the buf.gen.yaml per API and instead have a template in my root called "buf.gen.api.yaml" since the only part that is different is the output path. Then I would bbe able to use a command such as
buf generate --template buf.gen.api.yaml --path apps/api-a/internal/proto --outputroot apps/api-a
and then output the generated code relative to the outputroot path.Does my current solution work or is there a way to create an approach similiar to the one above and remove the duplication buf.gen.yaml files per API since they use the same plugins and just need the output to be relative to the api the code is being generated for?
The text was updated successfully, but these errors were encountered: