Allow exclude types
In the same way that --path and --exclude-path both exist together, I think it should be the same for --type and --exclude-type.
So I think there should be an --exclude-type option that excludes types from building/generating!
Can you explain what the use case is for this?
Can you explain what the use case is for this?
Yup! Maybe my case is supper rare but i have many services:
package api;
service A {}
service B {}
service C {}
service D {}
service E {}
Among them there's two specific services: A and B
It's a oneof situation: that means i need one of them at a time.
So it's simple to just exclude one of them e.g. by --exclude-type api.A to build or generate and not include all other services one by one and just not mentioning api.A: --type api.B --type api.C --type api.D --type api.E
Hi, for buf generate you can add an inputs section in buf.gen.yaml v2 to list out the types to generate. However, the --type flag is still needed for buf build.
# buf.gen.A.yaml
inputs:
- directory: .
types:
- api.A
- api.C
- api.D
- api.E
You can also create a buf.gen.B.yaml that contains everything but api.A. Then you can run buf generate --template buf.gen.A.yaml and vice versa.