support mulitple protoset files (#2190)

master
马守越 2 years ago committed by GitHub
parent 5d7919a9f5
commit 5348375b99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -29,8 +29,9 @@ type (
Upstream struct { Upstream struct {
// Grpc is the target of the upstream. // Grpc is the target of the upstream.
Grpc zrpc.RpcClientConf Grpc zrpc.RpcClientConf
// ProtoSet is the file of proto set, like hello.pb // ProtoSets is the file list of proto set, like [hello.pb]
ProtoSet string `json:",optional"` // if your proto file import another proto file, you need to write multi-file slice, like [hello.pb, common.pb]
ProtoSets []string `json:",optional"`
// Mapping is the mapping between gateway routes and Upstream rpc methods. // Mapping is the mapping between gateway routes and Upstream rpc methods.
// Keep it blank if annotations are added in rpc methods. // Keep it blank if annotations are added in rpc methods.
Mapping []RouteMapping `json:",optional"` Mapping []RouteMapping `json:",optional"`

@ -142,8 +142,8 @@ func (s *Server) createDescriptorSource(cli zrpc.Client, up Upstream) (grpcurl.D
var source grpcurl.DescriptorSource var source grpcurl.DescriptorSource
var err error var err error
if len(up.ProtoSet) > 0 { if len(up.ProtoSets) > 0 {
source, err = grpcurl.DescriptorSourceFromProtoSets(up.ProtoSet) source, err = grpcurl.DescriptorSourceFromProtoSets(up.ProtoSets...)
if err != nil { if err != nil {
return nil, err return nil, err
} }

Loading…
Cancel
Save