From b24cc22f23123d9715b18a25fc4a46fd4d1f668a Mon Sep 17 00:00:00 2001 From: Travis Cline Date: Sun, 20 Nov 2016 14:56:02 -0800 Subject: [PATCH] Allow methods with no bindings. Fixes #263 --- examples/examplepb/a_bit_of_everything.pb.go | 186 +++++++++++------- examples/examplepb/a_bit_of_everything.proto | 1 + examples/server/a_bit_of_everything.go | 4 + .../descriptor/services.go | 11 +- 4 files changed, 121 insertions(+), 81 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index d8e32353aec..b95a833e486 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -444,6 +444,7 @@ type ABitOfEverythingServiceClient interface { Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Echo(ctx context.Context, in *grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) + NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Timeout(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) } @@ -518,6 +519,15 @@ func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *AB return out, nil } +func (c *aBitOfEverythingServiceClient) 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.ABitOfEverythingService/NoBindings", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *aBitOfEverythingServiceClient) Timeout(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.ABitOfEverythingService/Timeout", in, out, c.cc, opts...) @@ -537,6 +547,7 @@ type ABitOfEverythingServiceServer interface { Delete(context.Context, *sub2.IdMessage) (*google_protobuf1.Empty, error) Echo(context.Context, *grpc_gateway_examples_sub.StringMessage) (*grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error) + NoBindings(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) Timeout(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) } @@ -670,6 +681,24 @@ func _ABitOfEverythingService_DeepPathEcho_Handler(srv interface{}, ctx context. return interceptor(ctx, in, info, handler) } +func _ABitOfEverythingService_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.(ABitOfEverythingServiceServer).NoBindings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).NoBindings(ctx, req.(*google_protobuf1.Empty)) + } + return interceptor(ctx, in, info, handler) +} + func _ABitOfEverythingService_Timeout_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 { @@ -720,6 +749,10 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "DeepPathEcho", Handler: _ABitOfEverythingService_DeepPathEcho_Handler, }, + { + MethodName: "NoBindings", + Handler: _ABitOfEverythingService_NoBindings_Handler, + }, { MethodName: "Timeout", Handler: _ABitOfEverythingService_Timeout_Handler, @@ -732,80 +765,81 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1198 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x57, 0xcb, 0x6e, 0xdb, 0x46, - 0x17, 0xf6, 0x48, 0xb6, 0x6c, 0x1d, 0x5a, 0xb2, 0x3c, 0x8e, 0x1d, 0x45, 0xfe, 0x7f, 0x88, 0x55, - 0xda, 0x82, 0x70, 0x0d, 0x12, 0x96, 0x83, 0x22, 0x31, 0x50, 0x04, 0xbe, 0xa8, 0x70, 0xd1, 0xc4, - 0x4e, 0xe9, 0x24, 0x0b, 0xa3, 0x81, 0x40, 0x49, 0x23, 0x99, 0xb0, 0xc8, 0x21, 0xc8, 0xa1, 0x6a, - 0x41, 0x55, 0x17, 0x5d, 0xf4, 0x05, 0xba, 0xe8, 0x2e, 0x9b, 0x02, 0x45, 0x37, 0x5d, 0x76, 0xdd, - 0x87, 0xe8, 0x1b, 0x14, 0x7d, 0x90, 0x82, 0x33, 0x24, 0x4d, 0xc9, 0x16, 0xe4, 0x0b, 0x90, 0x9d, - 0x66, 0xe6, 0x3b, 0xdf, 0x77, 0x2e, 0x73, 0xce, 0x50, 0xb0, 0x49, 0x2e, 0x0c, 0xcb, 0xe9, 0x12, - 0x4f, 0x0b, 0x7f, 0x38, 0x0d, 0xcd, 0xa8, 0x37, 0x4c, 0x56, 0xa7, 0xed, 0x3a, 0xe9, 0x11, 0xb7, - 0xcf, 0xce, 0x4c, 0xbb, 0xa3, 0x3a, 0x2e, 0x65, 0x14, 0x97, 0x3b, 0xae, 0xd3, 0x54, 0x3b, 0x06, - 0x23, 0xdf, 0x19, 0x7d, 0x35, 0x32, 0x55, 0x63, 0xd3, 0xd2, 0xff, 0x3a, 0x94, 0x76, 0xba, 0x44, - 0x33, 0x1c, 0x53, 0x33, 0x6c, 0x9b, 0x32, 0x83, 0x99, 0xd4, 0xf6, 0x84, 0x79, 0x69, 0x3d, 0x3c, - 0xe5, 0xab, 0x86, 0xdf, 0xd6, 0x88, 0xe5, 0xb0, 0x7e, 0x78, 0x58, 0x8a, 0x3d, 0xf1, 0xfc, 0x86, - 0x66, 0x11, 0xcf, 0x33, 0x3a, 0x24, 0x32, 0x4c, 0x9e, 0x55, 0xc7, 0x0e, 0xcb, 0xe3, 0xac, 0xcc, - 0xb4, 0x88, 0xc7, 0x0c, 0xcb, 0x11, 0x80, 0xca, 0x3f, 0x79, 0x28, 0xec, 0xee, 0x99, 0xec, 0xb8, - 0x5d, 0x8b, 0x03, 0xc2, 0xef, 0x20, 0xe7, 0x99, 0x76, 0xa7, 0x4b, 0xea, 0x36, 0xf1, 0x18, 0x69, - 0x15, 0x1f, 0xc9, 0x48, 0x91, 0xaa, 0x4f, 0xd5, 0x29, 0x21, 0xaa, 0xe3, 0x4c, 0xea, 0x11, 0xb7, - 0xd7, 0x17, 0x05, 0x9d, 0x58, 0x61, 0x0c, 0xb3, 0xbe, 0x6f, 0xb6, 0x8a, 0x48, 0x46, 0x4a, 0x56, - 0xe7, 0xbf, 0xf1, 0x2b, 0xc8, 0x84, 0x5a, 0x29, 0x39, 0x7d, 0x2f, 0xad, 0x90, 0x07, 0x97, 0x41, - 0x6a, 0x77, 0xa9, 0xc1, 0xea, 0x3d, 0xa3, 0xeb, 0x93, 0x62, 0x5a, 0x46, 0x4a, 0x4a, 0x07, 0xbe, - 0xf5, 0x36, 0xd8, 0xc1, 0x1f, 0xc1, 0x62, 0x8b, 0xfa, 0x8d, 0x2e, 0x09, 0x11, 0xb3, 0x32, 0x52, - 0x90, 0x2e, 0x89, 0x3d, 0x01, 0x29, 0x83, 0x64, 0xda, 0xec, 0xf3, 0x27, 0x21, 0x62, 0x4e, 0x46, - 0x4a, 0x5a, 0x07, 0xbe, 0x15, 0x73, 0xf8, 0x49, 0x44, 0x46, 0x46, 0xca, 0xac, 0x2e, 0xf9, 0x09, - 0x88, 0xe0, 0xd8, 0xae, 0x86, 0x88, 0x79, 0x19, 0x29, 0x73, 0x9c, 0x63, 0xbb, 0x2a, 0x00, 0x8f, - 0x21, 0xd7, 0x36, 0x2f, 0x48, 0x2b, 0x26, 0x59, 0x90, 0x91, 0x92, 0xd1, 0x17, 0xc3, 0xcd, 0x51, - 0x50, 0xcc, 0x93, 0x95, 0x91, 0x32, 0x1f, 0x82, 0x22, 0xa6, 0xff, 0x03, 0x34, 0x28, 0xed, 0x86, - 0x08, 0x90, 0x91, 0xb2, 0xa0, 0x67, 0x83, 0x9d, 0xd8, 0x59, 0x8f, 0xb9, 0xa6, 0xdd, 0x09, 0x01, - 0x12, 0xcf, 0xbf, 0x24, 0xf6, 0x46, 0xe2, 0x89, 0x55, 0x72, 0x32, 0x52, 0x72, 0x22, 0x9e, 0x48, - 0xe4, 0x6b, 0x00, 0x62, 0xfb, 0x56, 0x08, 0xc8, 0xcb, 0x48, 0xc9, 0x57, 0x37, 0xa7, 0x56, 0xeb, - 0xc8, 0xb7, 0x88, 0x6b, 0x36, 0x6b, 0xb6, 0x6f, 0xe9, 0xd9, 0xc0, 0x5e, 0x90, 0x7d, 0x02, 0x79, - 0x6f, 0x34, 0xae, 0x25, 0x19, 0x29, 0x4b, 0x7a, 0xce, 0x1b, 0x09, 0x2c, 0x86, 0xc5, 0x39, 0x2a, - 0xc8, 0x48, 0x29, 0x44, 0xb0, 0x44, 0x35, 0xbc, 0xa4, 0xf7, 0xcb, 0x32, 0x52, 0x96, 0x75, 0xc9, - 0x4b, 0x78, 0x1f, 0x42, 0x62, 0x1e, 0x2c, 0x23, 0x05, 0x0b, 0x48, 0xc4, 0x52, 0x85, 0x55, 0x97, - 0x38, 0xc4, 0x60, 0xa4, 0x55, 0x1f, 0xc9, 0xd7, 0x8a, 0x9c, 0x56, 0xb2, 0xfa, 0x4a, 0x74, 0x78, - 0x92, 0xc8, 0xdb, 0x33, 0x90, 0xa8, 0x4d, 0x82, 0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 0x62, 0xb4, 0x45, 0xd2, 0x37, 0x46, 0x56, 0x9a, - 0xdc, 0x99, 0x77, 0x78, 0x73, 0x9a, 0x33, 0xa4, 0x79, 0x46, 0xb5, 0x81, 0xb8, 0xb8, 0xa7, 0x8f, - 0x2a, 0x05, 0xad, 0x57, 0x8d, 0xf1, 0xc1, 0xd9, 0x8e, 0x18, 0x55, 0xa7, 0x18, 0x5f, 0x39, 0xc2, - 0x7f, 0x22, 0x58, 0x0c, 0x5e, 0x83, 0x57, 0x06, 0x3b, 0xe3, 0x91, 0x7c, 0x98, 0xeb, 0xfc, 0x9c, - 0xc7, 0xf6, 0xac, 0xf2, 0x64, 0x6a, 0xa2, 0x47, 0xfe, 0x99, 0xa8, 0xc1, 0x5b, 0xc9, 0x8b, 0xfb, - 0x16, 0xe6, 0x83, 0xb7, 0x96, 0xfa, 0x0c, 0x4f, 0x28, 0xe6, 0xc4, 0x22, 0xaf, 0x73, 0xed, 0x55, - 0xbc, 0x92, 0x4c, 0x06, 0x13, 0x64, 0x7b, 0xd2, 0x69, 0x36, 0x76, 0xbb, 0x91, 0xe1, 0x96, 0xdb, - 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xdb, 0xf3, 0x9f, 0xf3, 0x1a, 0x0e, 0x00, 0x00, + // 1211 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, 0x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 0x48, 0xc9, 0x89, 0x78, 0x22, 0x91, 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, 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x76, 0xcf, 0xc3, 0x33, 0xea, 0x39, 0xb3, 0xce, 0x0b, 0xf8, + 0x0d, 0x2c, 0x07, 0x6f, 0x35, 0xf5, 0xd9, 0x95, 0x8d, 0xef, 0x73, 0xdf, 0xef, 0xe0, 0xf5, 0x64, + 0x32, 0x99, 0x20, 0xab, 0x49, 0x47, 0xd9, 0x38, 0xec, 0x56, 0x86, 0x5b, 0x6e, 0xfd, 0x1f, 0x00, + 0x00, 0xff, 0xff, 0xa4, 0x27, 0xe2, 0xd1, 0x5a, 0x0e, 0x00, 0x00, } diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 85b44edfe42..651333549ef 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -115,6 +115,7 @@ service ABitOfEverythingService { body: "*" }; } + rpc NoBindings(google.protobuf.Empty) returns (google.protobuf.Empty) {} rpc Timeout(google.protobuf.Empty) returns (google.protobuf.Empty) { option (google.api.http) = { get: "/v2/example/timeout", diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 8c1badd95ee..88d39bb655c 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -221,6 +221,10 @@ func (s *_ABitOfEverythingServer) DeepPathEcho(ctx context.Context, msg *example return msg, nil } +func (s *_ABitOfEverythingServer) NoBindings(ctx context.Context, msg *empty.Empty) (*empty.Empty, error) { + return nil, nil +} + func (s *_ABitOfEverythingServer) Timeout(ctx context.Context, msg *empty.Empty) (*empty.Empty, error) { select { case <-ctx.Done(): diff --git a/protoc-gen-grpc-gateway/descriptor/services.go b/protoc-gen-grpc-gateway/descriptor/services.go index 8f7cb43c669..edf73caf77b 100644 --- a/protoc-gen-grpc-gateway/descriptor/services.go +++ b/protoc-gen-grpc-gateway/descriptor/services.go @@ -31,8 +31,7 @@ func (r *Registry) loadServices(file *File) error { return err } if opts == nil { - glog.V(1).Infof("Skip non-target method: %s.%s", svc.GetName(), md.GetName()) - continue + glog.V(1).Infof("Found non-target method: %s.%s", svc.GetName(), md.GetName()) } meth, err := r.newMethod(svc, md, opts) if err != nil { @@ -104,8 +103,8 @@ func (r *Registry) newMethod(svc *Service, md *descriptor.MethodDescriptorProto, pathTemplate = custom.Path default: - glog.Errorf("No pattern specified in google.api.HttpRule: %s", md.GetName()) - return nil, fmt.Errorf("none of pattern specified") + glog.V(1).Infof("No pattern specified in google.api.HttpRule: %s", md.GetName()) + return nil, nil } parsed, err := httprule.Parse(pathTemplate) @@ -147,7 +146,9 @@ func (r *Registry) newMethod(svc *Service, md *descriptor.MethodDescriptorProto, return nil, err } - meth.Bindings = append(meth.Bindings, b) + if b != nil { + meth.Bindings = append(meth.Bindings, b) + } for i, additional := range opts.GetAdditionalBindings() { if len(additional.AdditionalBindings) > 0 { return nil, fmt.Errorf("additional_binding in additional_binding not allowed: %s.%s", svc.GetName(), meth.GetName())