Skip to content

Commit

Permalink
support mulitple protoset files (#2190)
Browse files Browse the repository at this point in the history
  • Loading branch information
showurl committed Jul 27, 2022
1 parent 5d7919a commit 5348375
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions gateway/config.go
Expand Up @@ -29,8 +29,9 @@ type (
Upstream struct {
// Grpc is the target of the upstream.
Grpc zrpc.RpcClientConf
// ProtoSet is the file of proto set, like hello.pb
ProtoSet string `json:",optional"`
// ProtoSets is the file list of proto set, like [hello.pb]
// 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.
// Keep it blank if annotations are added in rpc methods.
Mapping []RouteMapping `json:",optional"`
Expand Down
4 changes: 2 additions & 2 deletions gateway/server.go
Expand Up @@ -142,8 +142,8 @@ func (s *Server) createDescriptorSource(cli zrpc.Client, up Upstream) (grpcurl.D
var source grpcurl.DescriptorSource
var err error

if len(up.ProtoSet) > 0 {
source, err = grpcurl.DescriptorSourceFromProtoSets(up.ProtoSet)
if len(up.ProtoSets) > 0 {
source, err = grpcurl.DescriptorSourceFromProtoSets(up.ProtoSets...)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 5348375

Please sign in to comment.