-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Support import external proto in goctl. #4268
Comments
maybe you can try with -I $external_path, |
first this directive has no way of taking effect, and the external proto code is not compiled by default |
I make it work. You also need |
I get a issue on gateway with importing validate.proto.
protoc -I ../../common/protobuf/ -I api/proto --descriptor_set_out=api/asset/user.pb api/proto/user.proto
protoc -I ../../common/protobuf/ --descriptor_set_out=api/asset/validate.pb ../../common/protobuf/validate.proto
protoc -I ../../common/protobuf/google/protobuf --descriptor_set_out=api/asset/google/protobuf/descriptor.pb ../../common/protobuf/google/protobuf/descriptor.proto # try 1
protoc -I ../../common/protobuf/google/protobuf --descriptor_set_out=api/asset/descriptor.pb ../../common/protobuf/google/protobuf/descriptor.proto # try 2
ProtoSets:
- asset/user.pb
- asset/validate.pb
- asset/google/protobuf/descriptor.pb # try 1
- asset/descriptor.pb # try 2
|
forget it. it work by adding |
Is your feature request related to a problem? Please describe.
In some scenarios, we may need to perform automatic validation of rpc parameters. for example,
protovalidate-go
library is introduced to automatically validate req.Next, I can verify req by directly generating the code automatically.
Describe the solution you'd like
buf-cli
instead ofprotoc
to generate go files for grpc and proto.The following is my solution case.
buf.gen.yaml
buf.yaml
In summary, we can get exactly the same grpc file and pb.go file with proto introduced.
But now there is a very fatal problem, I have import other proto files in proto early, resulting in the system's built-in generation function directly reported an error.
Describe alternatives you've considered
So I wonder if this syntax can be supported.
goctl rpc buf xx.proto --xxx
. If you are OK with my idea, I can try to submit a pr along these lines.Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: