From a5ee3d004c26d3ee98493d4925bfb19ac62cefe5 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Wed, 4 Jan 2017 14:10:50 -0800 Subject: [PATCH 1/2] Add example service with no bindings to demonstrate bug. --- examples/examplepb/a_bit_of_everything.pb.go | 218 ++++++++++++------- examples/examplepb/a_bit_of_everything.proto | 4 + 2 files changed, 146 insertions(+), 76 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index b95a833e486..c6cba0d1293 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -762,84 +762,150 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ Metadata: "examples/examplepb/a_bit_of_everything.proto", } +// Client API for AnotherServiceWithNoBindings service + +type AnotherServiceWithNoBindingsClient interface { + NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) +} + +type anotherServiceWithNoBindingsClient struct { + cc *grpc.ClientConn +} + +func NewAnotherServiceWithNoBindingsClient(cc *grpc.ClientConn) AnotherServiceWithNoBindingsClient { + return &anotherServiceWithNoBindingsClient{cc} +} + +func (c *anotherServiceWithNoBindingsClient) NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for AnotherServiceWithNoBindings service + +type AnotherServiceWithNoBindingsServer interface { + NoBindings(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) +} + +func RegisterAnotherServiceWithNoBindingsServer(s *grpc.Server, srv AnotherServiceWithNoBindingsServer) { + s.RegisterService(&_AnotherServiceWithNoBindings_serviceDesc, srv) +} + +func _AnotherServiceWithNoBindings_NoBindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_protobuf1.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AnotherServiceWithNoBindingsServer).NoBindings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AnotherServiceWithNoBindingsServer).NoBindings(ctx, req.(*google_protobuf1.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings", + HandlerType: (*AnotherServiceWithNoBindingsServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "NoBindings", + Handler: _AnotherServiceWithNoBindings_NoBindings_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "examples/examplepb/a_bit_of_everything.proto", +} + func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1211 bytes of a gzipped FileDescriptorProto + // 1233 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0xf6, 0x4a, 0xb6, 0x6c, 0x0d, 0x2d, 0x59, 0x59, 0x27, 0x8e, 0xa2, 0xb4, 0x10, 0xab, 0xb4, - 0x05, 0xe1, 0x06, 0x24, 0x22, 0x07, 0x45, 0x62, 0xa0, 0x0d, 0x2c, 0x5b, 0x85, 0x8b, 0x26, 0x72, - 0x4a, 0x27, 0x39, 0x18, 0x0d, 0x04, 0x4a, 0x5a, 0xc9, 0x84, 0x45, 0x2e, 0x41, 0x2e, 0x55, 0x0b, - 0xaa, 0x7a, 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x91, 0x6f, - 0x00, 0x88, 0xed, 0x5b, 0x21, 0x20, 0x2f, 0x23, 0x25, 0x5f, 0x7d, 0x38, 0xb7, 0x5a, 0x0d, 0xdf, - 0x22, 0xae, 0xd9, 0xae, 0xdb, 0xbe, 0xa5, 0x67, 0x03, 0x7b, 0x41, 0xf6, 0x09, 0xe4, 0xbd, 0xc9, - 0xb8, 0xd6, 0x64, 0xa4, 0xac, 0xe9, 0x39, 0x6f, 0x22, 0xb0, 0x18, 0x16, 0xe7, 0xa8, 0x20, 0x23, - 0xa5, 0x10, 0xc1, 0x12, 0xd5, 0xf0, 0x92, 0xde, 0xdf, 0x92, 0x91, 0x72, 0x4b, 0x97, 0xbc, 0x84, - 0xf7, 0x21, 0x24, 0xe6, 0xc1, 0x32, 0x52, 0xb0, 0x80, 0x44, 0x2c, 0x55, 0xb8, 0xe3, 0x12, 0x87, - 0x18, 0x8c, 0x74, 0x9a, 0x13, 0xf9, 0x5a, 0x97, 0xd3, 0x4a, 0x56, 0x5f, 0x8f, 0x0e, 0x0f, 0x13, - 0x79, 0x7b, 0x0a, 0x12, 0xb5, 0x49, 0x30, 0x16, 0x82, 0xae, 0x2d, 0xde, 0xe6, 0xfd, 0xb2, 0xa1, - 0x8a, 0xee, 0x53, 0xa3, 0xee, 0x53, 0xeb, 0xc1, 0xe9, 0xfe, 0x82, 0x0e, 0x1c, 0xcc, 0x57, 0xf8, - 0x01, 0xac, 0x0a, 0x53, 0xa1, 0x55, 0xbc, 0x13, 0x54, 0x65, 0x7f, 0x41, 0x17, 0x84, 0x42, 0x04, - 0x7f, 0x07, 0x59, 0xcb, 0x70, 0x42, 0x3f, 0x36, 0x78, 0x87, 0x3c, 0xbb, 0x7a, 0x87, 0xbc, 0x30, - 0x1c, 0xee, 0x6e, 0xdd, 0x66, 0xee, 0x50, 0x5f, 0xb1, 0xc2, 0x25, 0x3e, 0x85, 0x75, 0xcb, 0x70, - 0x9c, 0xe9, 0x78, 0xef, 0x72, 0x9d, 0xfd, 0x6b, 0xe9, 0x38, 0x13, 0xf9, 0x11, 0x82, 0xb7, 0xac, - 0xe9, 0xfd, 0x84, 0xb2, 0xe8, 0xda, 0x50, 0xb9, 0x78, 0x33, 0x65, 0x31, 0x09, 0xce, 0x2b, 0x27, - 0xf6, 0xf1, 0x36, 0x14, 0x6d, 0x6a, 0xef, 0x52, 0x7b, 0x40, 0xec, 0x60, 0x0e, 0x1b, 0xfd, 0x86, - 0x61, 0x89, 0xb6, 0x2f, 0x96, 0x78, 0x63, 0xcc, 0x3c, 0xc7, 0xbb, 0xb0, 0x16, 0xcf, 0xd1, 0xd0, - 0xe3, 0xfb, 0xbc, 0xe2, 0xa5, 0x73, 0x15, 0x7f, 0x15, 0xe1, 0xf4, 0x7c, 0x6c, 0xc2, 0x49, 0x4a, - 0xbf, 0x23, 0xc8, 0x9c, 0x0d, 0x44, 0xdb, 0xb0, 0x48, 0x34, 0x10, 0x83, 0xdf, 0x78, 0x03, 0x32, - 0x86, 0x45, 0x7d, 0x9b, 0x15, 0x53, 0xbc, 0x07, 0xc3, 0x15, 0xfe, 0x16, 0x52, 0xf4, 0x84, 0x4f, - 0xb3, 0x7c, 0x75, 0xe7, 0xba, 0x43, 0x52, 0xdd, 0x23, 0xc4, 0xe1, 0xbd, 0x98, 0xa2, 0x27, 0x95, - 0x32, 0xac, 0x44, 0x6b, 0x9c, 0x85, 0xa5, 0xaf, 0x76, 0x9e, 0x1f, 0xd6, 0x0b, 0x0b, 0x78, 0x05, - 0x16, 0x5f, 0xe9, 0xaf, 0xeb, 0x05, 0x54, 0x32, 0x21, 0x37, 0x71, 0x75, 0x70, 0x01, 0xd2, 0x27, - 0x64, 0x18, 0xfa, 0x1b, 0xfc, 0xc4, 0x35, 0x58, 0x12, 0x89, 0x48, 0x5d, 0x63, 0x20, 0x08, 0xd3, - 0xed, 0xd4, 0x13, 0x54, 0xda, 0x83, 0x8d, 0x8b, 0x6f, 0xcf, 0x05, 0x9a, 0xb7, 0x93, 0x9a, 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d8, 0xb5, 0x74, 0xa7, 0x47, 0x69, 0x6f, 0x40, 0x34, + 0xc3, 0x31, 0x35, 0xc3, 0xb6, 0x29, 0x33, 0x98, 0x49, 0x6d, 0x4f, 0xb8, 0x97, 0x6e, 0x87, 0x56, + 0xbe, 0x6a, 0xf9, 0x5d, 0x8d, 0x58, 0x0e, 0x1b, 0x85, 0xc6, 0x52, 0x1c, 0x89, 0xe7, 0xb7, 0x34, + 0x8b, 0x78, 0x9e, 0xd1, 0x23, 0x91, 0x63, 0xd2, 0x56, 0x9d, 0x31, 0x96, 0x67, 0x59, 0x99, 0x69, + 0x11, 0x8f, 0x19, 0x96, 0x23, 0x00, 0x95, 0x7f, 0xf2, 0x50, 0xd8, 0xad, 0x99, 0x6c, 0xbf, 0x5b, + 0x8f, 0x13, 0xc2, 0x6f, 0x21, 0xe7, 0x99, 0x76, 0x6f, 0x40, 0x9a, 0x36, 0xf1, 0x18, 0xe9, 0x14, + 0x6f, 0xc9, 0x48, 0x91, 0xaa, 0x8f, 0xd4, 0x05, 0x29, 0xaa, 0xb3, 0x4c, 0x6a, 0x83, 0xfb, 0xeb, + 0xeb, 0x82, 0x4e, 0xac, 0x30, 0x86, 0x65, 0xdf, 0x37, 0x3b, 0x45, 0x24, 0x23, 0x25, 0xab, 0xf3, + 0xdf, 0xf8, 0x25, 0x64, 0x42, 0xad, 0x94, 0x9c, 0xbe, 0x92, 0x56, 0xc8, 0x83, 0xcb, 0x20, 0x75, + 0x07, 0xd4, 0x60, 0xcd, 0xa1, 0x31, 0xf0, 0x49, 0x31, 0x2d, 0x23, 0x25, 0xa5, 0x03, 0xdf, 0x7a, + 0x13, 0xec, 0xe0, 0xff, 0xc3, 0x7a, 0x87, 0xfa, 0xad, 0x01, 0x09, 0x11, 0xcb, 0x32, 0x52, 0x90, + 0x2e, 0x89, 0x3d, 0x01, 0x29, 0x83, 0x64, 0xda, 0xec, 0x93, 0x87, 0x21, 0x62, 0x45, 0x46, 0x4a, + 0x5a, 0x07, 0xbe, 0x15, 0x73, 0xf8, 0x49, 0x44, 0x46, 0x46, 0xca, 0xb2, 0x2e, 0xf9, 0x09, 0x88, + 0xe0, 0x78, 0x50, 0x0d, 0x11, 0xab, 0x32, 0x52, 0x56, 0x38, 0xc7, 0x83, 0xaa, 0x00, 0xdc, 0x85, + 0x5c, 0xd7, 0x3c, 0x26, 0x9d, 0x98, 0x64, 0x4d, 0x46, 0x4a, 0x46, 0x5f, 0x0f, 0x37, 0xa7, 0x41, + 0x31, 0x4f, 0x56, 0x46, 0xca, 0x6a, 0x08, 0x8a, 0x98, 0xfe, 0x07, 0xd0, 0xa2, 0x74, 0x10, 0x22, + 0x40, 0x46, 0xca, 0x9a, 0x9e, 0x0d, 0x76, 0xe2, 0x60, 0x3d, 0xe6, 0x9a, 0x76, 0x2f, 0x04, 0x48, + 0xbc, 0xfe, 0x92, 0xd8, 0x9b, 0xca, 0x27, 0x56, 0xc9, 0xc9, 0x48, 0xc9, 0x89, 0x7c, 0x22, 0x91, + 0x2f, 0x01, 0x88, 0xed, 0x5b, 0x21, 0x20, 0x2f, 0x23, 0x25, 0x5f, 0xbd, 0xb7, 0xb0, 0x5b, 0x0d, + 0xdf, 0x22, 0xae, 0xd9, 0xae, 0xdb, 0xbe, 0xa5, 0x67, 0x03, 0x7f, 0x41, 0xf6, 0x21, 0xe4, 0xbd, + 0xe9, 0xbc, 0x36, 0x64, 0xa4, 0x6c, 0xe8, 0x39, 0x6f, 0x2a, 0xb1, 0x18, 0x16, 0xd7, 0xa8, 0x20, + 0x23, 0xa5, 0x10, 0xc1, 0x12, 0xdd, 0xf0, 0x92, 0xd1, 0x5f, 0x93, 0x91, 0x72, 0x4d, 0x97, 0xbc, + 0x44, 0xf4, 0x21, 0x24, 0xe6, 0xc1, 0x32, 0x52, 0xb0, 0x80, 0x44, 0x2c, 0x55, 0xb8, 0xe1, 0x12, + 0x87, 0x18, 0x8c, 0x74, 0x9a, 0x53, 0xf5, 0xda, 0x94, 0xd3, 0x4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ed, 0xf3, 0xe6, 0xfa, 0x27, 0x82, 0xe5, 0x7a, + 0xbb, 0x4f, 0xb1, 0x32, 0x27, 0x53, 0xcf, 0x6f, 0xa9, 0x62, 0xb4, 0x45, 0xd2, 0xe7, 0x46, 0x56, + 0xda, 0x3c, 0x98, 0xb7, 0xf8, 0xde, 0xa2, 0x60, 0x48, 0xbb, 0x4f, 0xb5, 0xb1, 0x38, 0xb8, 0x87, + 0xb7, 0x2a, 0x05, 0x6d, 0x58, 0x8d, 0xf1, 0x81, 0x6d, 0x47, 0x8c, 0xaa, 0x43, 0x8c, 0x4f, 0x99, + 0xf0, 0x1f, 0x08, 0xd6, 0x83, 0xd7, 0xe0, 0xa5, 0xc1, 0xfa, 0x3c, 0x93, 0xf7, 0x73, 0x9c, 0x9f, + 0xf0, 0xdc, 0x1e, 0x57, 0x1e, 0x2e, 0x2c, 0xf4, 0xd4, 0x3f, 0x13, 0x35, 0x78, 0x2b, 0x79, 0x73, + 0x3f, 0x03, 0x68, 0xd0, 0x9a, 0x69, 0x77, 0x4c, 0xbb, 0xe7, 0xe1, 0x39, 0xfd, 0x9c, 0xdb, 0xe7, + 0x25, 0xfc, 0x06, 0x56, 0x83, 0xb7, 0x9a, 0xfa, 0xec, 0xc2, 0xce, 0xb7, 0x79, 0xec, 0x37, 0xf0, + 0x66, 0xb2, 0x98, 0x4c, 0x90, 0x55, 0xbf, 0x85, 0x3b, 0xbb, 0x36, 0x65, 0x7d, 0xe2, 0x86, 0xf3, + 0xfc, 0x6b, 0x93, 0xf5, 0x13, 0x91, 0x5e, 0x31, 0xee, 0x9a, 0x74, 0x98, 0x8d, 0xcb, 0xda, 0xca, + 0x70, 0xf3, 0x83, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x59, 0xdb, 0x5f, 0x3e, 0xba, 0x0e, 0x00, + 0x00, } diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 651333549ef..292803fedd9 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -122,3 +122,7 @@ service ABitOfEverythingService { }; } } + +service AnotherServiceWithNoBindings { + rpc NoBindings(google.protobuf.Empty) returns (google.protobuf.Empty) {} +} From 35db47c30ed6a21aa6ac8056fba0f76df55f67a0 Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Wed, 4 Jan 2017 14:12:48 -0800 Subject: [PATCH 2/2] Skip services that have no methods with http bindings --- protoc-gen-grpc-gateway/gengateway/template.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/protoc-gen-grpc-gateway/gengateway/template.go b/protoc-gen-grpc-gateway/gengateway/template.go index 3c3da539b95..5a3d914ef16 100644 --- a/protoc-gen-grpc-gateway/gengateway/template.go +++ b/protoc-gen-grpc-gateway/gengateway/template.go @@ -71,22 +71,26 @@ func applyTemplate(p param) (string, error) { if err := headerTemplate.Execute(w, p); err != nil { return "", err } - var methodSeen bool + var targetServices []*descriptor.Service for _, svc := range p.Services { + var methodWithBindingsSeen bool for _, meth := range svc.Methods { glog.V(2).Infof("Processing %s.%s", svc.GetName(), meth.GetName()) - methodSeen = true for _, b := range meth.Bindings { + methodWithBindingsSeen = true if err := handlerTemplate.Execute(w, binding{Binding: b}); err != nil { return "", err } } } + if methodWithBindingsSeen { + targetServices = append(targetServices, svc) + } } - if !methodSeen { + if len(targetServices) == 0 { return "", errNoTargetService } - if err := trailerTemplate.Execute(w, p.Services); err != nil { + if err := trailerTemplate.Execute(w, targetServices); err != nil { return "", err } return w.String(), nil