From 00ff8daee5e28fb24d787017cb7a690e6551c561 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Mon, 13 Jun 2016 17:45:45 +0900 Subject: [PATCH 1/2] Dedupe a_bit_of_everything.proto and streamless_everything.proto --- Makefile | 3 +- examples/examplepb/a_bit_of_everything.pb.go | 357 +++++------------- .../examplepb/a_bit_of_everything.pb.gw.go | 200 ---------- examples/examplepb/a_bit_of_everything.proto | 27 +- ....json => a_bit_of_everything.swagger.json} | 143 ++++--- examples/examplepb/echo_service.pb.go | 1 + examples/examplepb/flow_combination.pb.go | 14 +- examples/examplepb/stream.pb.go | 277 ++++++++++++++ examples/examplepb/stream.pb.gw.go | 266 +++++++++++++ examples/examplepb/stream.proto | 28 ++ .../examplepb/streamless_everything.proto | 138 ------- examples/main.go | 4 + examples/server/a_bit_of_everything.go | 13 +- examples/server/main.go | 6 +- 14 files changed, 758 insertions(+), 719 deletions(-) rename examples/examplepb/{streamless_everything.swagger.json => a_bit_of_everything.swagger.json} (94%) create mode 100644 examples/examplepb/stream.pb.go create mode 100644 examples/examplepb/stream.pb.gw.go create mode 100644 examples/examplepb/stream.proto delete mode 100644 examples/examplepb/streamless_everything.proto diff --git a/Makefile b/Makefile index 34e364b6921..7a56ac69bc3 100644 --- a/Makefile +++ b/Makefile @@ -46,9 +46,10 @@ RUNTIME_GO=$(RUNTIME_PROTO:.proto=.pb.go) PKGMAP=Mgoogle/protobuf/descriptor.proto=$(GO_PLUGIN_PKG)/descriptor,Mgoogle/api/annotations.proto=$(PKG)/$(GOOGLEAPIS_DIR)/google/api,Mexamples/sub/message.proto=$(PKG)/examples/sub SWAGGER_EXAMPLES=examples/examplepb/echo_service.proto \ - examples/examplepb/streamless_everything.proto + examples/examplepb/a_bit_of_everything.proto EXAMPLES=examples/examplepb/echo_service.proto \ examples/examplepb/a_bit_of_everything.proto \ + examples/examplepb/stream.proto \ examples/examplepb/flow_combination.proto EXAMPLE_SVCSRCS=$(EXAMPLES:.proto=.pb.go) EXAMPLE_GWSRCS=$(EXAMPLES:.proto=.pb.gw.go) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 470928b33ca..09f9274cdce 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -21,11 +21,14 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +// NumericEnum is one or zero. type NumericEnum int32 const ( + // ZERO means 0 NumericEnum_ZERO NumericEnum = 0 - NumericEnum_ONE NumericEnum = 1 + // ONE means 1 + NumericEnum_ONE NumericEnum = 1 ) var NumericEnum_name = map[int32]string{ @@ -42,11 +45,14 @@ func (x NumericEnum) String() string { } func (NumericEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } +// DeepEnum is one or zero. type ABitOfEverything_Nested_DeepEnum int32 const ( + // FALSE is false. ABitOfEverything_Nested_FALSE ABitOfEverything_Nested_DeepEnum = 0 - ABitOfEverything_Nested_TRUE ABitOfEverything_Nested_DeepEnum = 1 + // TRUE is true. + ABitOfEverything_Nested_TRUE ABitOfEverything_Nested_DeepEnum = 1 ) var ABitOfEverything_Nested_DeepEnum_name = map[int32]string{ @@ -243,7 +249,9 @@ func _ABitOfEverything_OneofSizer(msg proto.Message) (n int) { return n } +// Nested is nested type. type ABitOfEverything_Nested struct { + // name is nested field. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Amount uint32 `protobuf:"varint,2,opt,name=amount" json:"amount,omitempty"` Ok ABitOfEverything_Nested_DeepEnum `protobuf:"varint,3,opt,name=ok,enum=gengo.grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"` @@ -283,13 +291,10 @@ const _ = grpc.SupportPackageIsVersion2 type ABitOfEverythingServiceClient interface { Create(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) CreateBody(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) - BulkCreate(ctx context.Context, opts ...grpc.CallOption) (ABitOfEverythingService_BulkCreateClient, error) Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) - List(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (ABitOfEverythingService_ListClient, error) Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*EmptyMessage, error) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*EmptyMessage, error) Echo(ctx context.Context, in *gengo_grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*gengo_grpc_gateway_examples_sub.StringMessage, error) - BulkEcho(ctx context.Context, opts ...grpc.CallOption) (ABitOfEverythingService_BulkEchoClient, error) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) Timeout(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*EmptyMessage, error) } @@ -320,40 +325,6 @@ func (c *aBitOfEverythingServiceClient) CreateBody(ctx context.Context, in *ABit return out, nil } -func (c *aBitOfEverythingServiceClient) BulkCreate(ctx context.Context, opts ...grpc.CallOption) (ABitOfEverythingService_BulkCreateClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ABitOfEverythingService_serviceDesc.Streams[0], c.cc, "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/BulkCreate", opts...) - if err != nil { - return nil, err - } - x := &aBitOfEverythingServiceBulkCreateClient{stream} - return x, nil -} - -type ABitOfEverythingService_BulkCreateClient interface { - Send(*ABitOfEverything) error - CloseAndRecv() (*EmptyMessage, error) - grpc.ClientStream -} - -type aBitOfEverythingServiceBulkCreateClient struct { - grpc.ClientStream -} - -func (x *aBitOfEverythingServiceBulkCreateClient) Send(m *ABitOfEverything) error { - return x.ClientStream.SendMsg(m) -} - -func (x *aBitOfEverythingServiceBulkCreateClient) CloseAndRecv() (*EmptyMessage, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(EmptyMessage) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", in, out, c.cc, opts...) @@ -363,38 +334,6 @@ func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdM return out, nil } -func (c *aBitOfEverythingServiceClient) List(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (ABitOfEverythingService_ListClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ABitOfEverythingService_serviceDesc.Streams[1], c.cc, "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/List", opts...) - if err != nil { - return nil, err - } - x := &aBitOfEverythingServiceListClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type ABitOfEverythingService_ListClient interface { - Recv() (*ABitOfEverything, error) - grpc.ClientStream -} - -type aBitOfEverythingServiceListClient struct { - grpc.ClientStream -} - -func (x *aBitOfEverythingServiceListClient) Recv() (*ABitOfEverything, error) { - m := new(ABitOfEverything) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*EmptyMessage, error) { out := new(EmptyMessage) err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", in, out, c.cc, opts...) @@ -422,37 +361,6 @@ func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *gengo_grpc return out, nil } -func (c *aBitOfEverythingServiceClient) BulkEcho(ctx context.Context, opts ...grpc.CallOption) (ABitOfEverythingService_BulkEchoClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ABitOfEverythingService_serviceDesc.Streams[2], c.cc, "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/BulkEcho", opts...) - if err != nil { - return nil, err - } - x := &aBitOfEverythingServiceBulkEchoClient{stream} - return x, nil -} - -type ABitOfEverythingService_BulkEchoClient interface { - Send(*gengo_grpc_gateway_examples_sub.StringMessage) error - Recv() (*gengo_grpc_gateway_examples_sub.StringMessage, error) - grpc.ClientStream -} - -type aBitOfEverythingServiceBulkEchoClient struct { - grpc.ClientStream -} - -func (x *aBitOfEverythingServiceBulkEchoClient) Send(m *gengo_grpc_gateway_examples_sub.StringMessage) error { - return x.ClientStream.SendMsg(m) -} - -func (x *aBitOfEverythingServiceBulkEchoClient) Recv() (*gengo_grpc_gateway_examples_sub.StringMessage, error) { - m := new(gengo_grpc_gateway_examples_sub.StringMessage) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", in, out, c.cc, opts...) @@ -476,13 +384,10 @@ func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *EmptyMe type ABitOfEverythingServiceServer interface { Create(context.Context, *ABitOfEverything) (*ABitOfEverything, error) CreateBody(context.Context, *ABitOfEverything) (*ABitOfEverything, error) - BulkCreate(ABitOfEverythingService_BulkCreateServer) error Lookup(context.Context, *sub2.IdMessage) (*ABitOfEverything, error) - List(*EmptyMessage, ABitOfEverythingService_ListServer) error Update(context.Context, *ABitOfEverything) (*EmptyMessage, error) Delete(context.Context, *sub2.IdMessage) (*EmptyMessage, error) Echo(context.Context, *gengo_grpc_gateway_examples_sub.StringMessage) (*gengo_grpc_gateway_examples_sub.StringMessage, error) - BulkEcho(ABitOfEverythingService_BulkEchoServer) error DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error) Timeout(context.Context, *EmptyMessage) (*EmptyMessage, error) } @@ -527,32 +432,6 @@ func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Co return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_BulkCreate_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ABitOfEverythingServiceServer).BulkCreate(&aBitOfEverythingServiceBulkCreateServer{stream}) -} - -type ABitOfEverythingService_BulkCreateServer interface { - SendAndClose(*EmptyMessage) error - Recv() (*ABitOfEverything, error) - grpc.ServerStream -} - -type aBitOfEverythingServiceBulkCreateServer struct { - grpc.ServerStream -} - -func (x *aBitOfEverythingServiceBulkCreateServer) SendAndClose(m *EmptyMessage) error { - return x.ServerStream.SendMsg(m) -} - -func (x *aBitOfEverythingServiceBulkCreateServer) Recv() (*ABitOfEverything, error) { - m := new(ABitOfEverything) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - func _ABitOfEverythingService_Lookup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(sub2.IdMessage) if err := dec(in); err != nil { @@ -571,27 +450,6 @@ func _ABitOfEverythingService_Lookup_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_List_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(EmptyMessage) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ABitOfEverythingServiceServer).List(m, &aBitOfEverythingServiceListServer{stream}) -} - -type ABitOfEverythingService_ListServer interface { - Send(*ABitOfEverything) error - grpc.ServerStream -} - -type aBitOfEverythingServiceListServer struct { - grpc.ServerStream -} - -func (x *aBitOfEverythingServiceListServer) Send(m *ABitOfEverything) error { - return x.ServerStream.SendMsg(m) -} - func _ABitOfEverythingService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { @@ -646,32 +504,6 @@ func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } -func _ABitOfEverythingService_BulkEcho_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ABitOfEverythingServiceServer).BulkEcho(&aBitOfEverythingServiceBulkEchoServer{stream}) -} - -type ABitOfEverythingService_BulkEchoServer interface { - Send(*gengo_grpc_gateway_examples_sub.StringMessage) error - Recv() (*gengo_grpc_gateway_examples_sub.StringMessage, error) - grpc.ServerStream -} - -type aBitOfEverythingServiceBulkEchoServer struct { - grpc.ServerStream -} - -func (x *aBitOfEverythingServiceBulkEchoServer) Send(m *gengo_grpc_gateway_examples_sub.StringMessage) error { - return x.ServerStream.SendMsg(m) -} - -func (x *aBitOfEverythingServiceBulkEchoServer) Recv() (*gengo_grpc_gateway_examples_sub.StringMessage, error) { - m := new(gengo_grpc_gateway_examples_sub.StringMessage) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - func _ABitOfEverythingService_DeepPathEcho_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ABitOfEverything) if err := dec(in); err != nil { @@ -745,104 +577,83 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ Handler: _ABitOfEverythingService_Timeout_Handler, }, }, - Streams: []grpc.StreamDesc{ - { - StreamName: "BulkCreate", - Handler: _ABitOfEverythingService_BulkCreate_Handler, - ClientStreams: true, - }, - { - StreamName: "List", - Handler: _ABitOfEverythingService_List_Handler, - ServerStreams: true, - }, - { - StreamName: "BulkEcho", - Handler: _ABitOfEverythingService_BulkEcho_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, + Streams: []grpc.StreamDesc{}, } func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1216 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x57, 0xdd, 0x6e, 0x1b, 0x45, - 0x1b, 0xee, 0xda, 0x89, 0x63, 0x8f, 0x7f, 0xea, 0x4c, 0x9a, 0xd4, 0x75, 0xbf, 0x4f, 0x49, 0x97, - 0x16, 0x42, 0xa8, 0x76, 0xa9, 0x53, 0xf1, 0x13, 0x09, 0x50, 0xd3, 0x18, 0x8a, 0x94, 0x26, 0xb0, - 0x49, 0x83, 0x14, 0x09, 0x59, 0x6b, 0x7b, 0xe2, 0xac, 0xe2, 0xdd, 0x59, 0xed, 0x8f, 0xa9, 0x15, - 0xa5, 0x07, 0x15, 0x17, 0x80, 0xc4, 0x05, 0x70, 0x80, 0x84, 0x44, 0xa5, 0x72, 0x07, 0x1c, 0x70, - 0xcc, 0x21, 0xb7, 0xc0, 0x0d, 0x70, 0x07, 0xbc, 0x3b, 0xb3, 0xbb, 0x99, 0x75, 0x52, 0x6c, 0x36, - 0x55, 0x38, 0xf2, 0xce, 0xcc, 0xb3, 0xcf, 0xfb, 0xbc, 0xbf, 0xb3, 0x46, 0x77, 0xc9, 0x53, 0xdd, - 0xb4, 0xfb, 0xc4, 0x55, 0xc3, 0x07, 0xbb, 0xad, 0xea, 0xad, 0xb6, 0xe1, 0xb5, 0xe8, 0x41, 0x8b, - 0x0c, 0x88, 0x33, 0xf4, 0x0e, 0x0d, 0xab, 0xa7, 0xd8, 0x0e, 0xf5, 0x28, 0xbe, 0xd3, 0x23, 0x56, - 0x8f, 0x2a, 0x3d, 0xc7, 0xee, 0x28, 0x3d, 0xdd, 0x23, 0xdf, 0xe8, 0x43, 0x25, 0x22, 0x50, 0x62, - 0x82, 0xfa, 0xff, 0x7a, 0x94, 0xf6, 0xfa, 0x44, 0xd5, 0x6d, 0x43, 0xd5, 0x2d, 0x8b, 0x7a, 0xba, - 0x67, 0x50, 0xcb, 0xe5, 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d, 0x71, 0xc2, 0x08, 0xa8, 0x51, 0x8f, 0xf9, 0xa4, 0xd9, 0xbf, 0x21, 0x57, - 0xd5, 0x41, 0x23, 0xc6, 0x07, 0x67, 0x6b, 0xfc, 0xde, 0xd9, 0xc7, 0xf8, 0xcc, 0x51, 0x50, 0x9b, - 0xf9, 0xa0, 0xa1, 0x2f, 0xc5, 0xa3, 0x89, 0x1b, 0x98, 0xa9, 0x0e, 0x1a, 0x18, 0x6a, 0xf3, 0x37, - 0x09, 0x95, 0x82, 0x2f, 0x91, 0x2f, 0x74, 0xef, 0x90, 0xa9, 0xbc, 0xfc, 0x09, 0xf9, 0x09, 0xd3, - 0xfd, 0xa1, 0x7c, 0x7f, 0x6c, 0x89, 0x24, 0xfe, 0x23, 0x2b, 0xc1, 0x97, 0x1b, 0xab, 0xd9, 0xef, - 0x24, 0x34, 0xb3, 0x6b, 0x98, 0x84, 0xfa, 0x29, 0x87, 0x40, 0xaa, 0xca, 0xbe, 0xc9, 0x64, 0xcf, - 0xe3, 0x39, 0x31, 0xeb, 0x1e, 0x97, 0xb1, 0x5e, 0xdc, 0x2f, 0xc4, 0xaf, 0xb5, 0x73, 0xec, 0x9f, - 0xff, 0xea, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x51, 0xf7, 0x09, 0x87, 0xa7, 0x10, 0x00, 0x00, + // 1152 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x57, 0xed, 0x6e, 0x1b, 0x45, + 0x17, 0xee, 0xda, 0x89, 0x13, 0x1f, 0x7f, 0xc4, 0x99, 0x34, 0xa9, 0xeb, 0xbe, 0xaf, 0x12, 0x0c, + 0x45, 0x55, 0xa8, 0x76, 0xd5, 0x4d, 0xc5, 0x47, 0x24, 0x40, 0x4d, 0x63, 0x28, 0x52, 0x9b, 0xc0, + 0x26, 0x0d, 0x52, 0x24, 0x64, 0xad, 0xed, 0x89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9c, 0x4f, 0xdd, + 0xe2, 0x2c, 0x46, 0x59, 0x90, 0x8a, 0x15, 0x21, 0x30, 0x15, 0x86, 0x56, 0xaf, 0xae, 0x20, 0x77, + 0xd1, 0xe0, 0xcf, 0x64, 0x0f, 0x0a, 0xb1, 0xc7, 0xdc, 0x4a, 0xfe, 0x35, 0x78, 0x8c, 0xd9, 0xc8, + 0x32, 0x94, 0x0e, 0x06, 0xcc, 0x0c, 0xda, 0x43, 0x73, 0x10, 0xd2, 0x7a, 0x1e, 0x5d, 0xe6, 0x0c, + 0xe0, 0xa6, 0xbd, 0xc8, 0x42, 0xde, 0x80, 0x72, 0x8f, 0x85, 0x1d, 0x8c, 0x58, 0x20, 0xa6, 0x10, + 0xa1, 0x18, 0x25, 0x61, 0x13, 0x10, 0xe4, 0xb0, 0x9c, 0xe0, 0xdd, 0xfb, 0x31, 0x62, 0x1a, 0x11, + 0x79, 0x03, 0xb8, 0x29, 0xe5, 0x08, 0x65, 0x44, 0x01, 0x11, 0x53, 0x46, 0x29, 0x94, 0x20, 0x82, + 0x63, 0x4d, 0x8f, 0x11, 0x33, 0x88, 0x98, 0xe6, 0x1c, 0x6b, 0xba, 0x00, 0xbc, 0x09, 0x95, 0x03, + 0xeb, 0x19, 0xed, 0xa5, 0x24, 0xb3, 0x08, 0x29, 0x18, 0xe5, 0xd8, 0x98, 0x05, 0xa5, 0x3c, 0x45, + 0x04, 0xcd, 0xc4, 0xa0, 0x84, 0xe9, 0xff, 0x00, 0x1d, 0xc6, 0x06, 0x31, 0x02, 0x10, 0x31, 0x6b, + 0x14, 0x23, 0x4b, 0x2a, 0xd6, 0x0f, 0x3c, 0x4c, 0x55, 0x0c, 0x28, 0xf1, 0x2a, 0x94, 0x84, 0x2d, + 0x13, 0x4f, 0xea, 0xa5, 0x82, 0x90, 0x8a, 0x88, 0x27, 0x71, 0xf2, 0x05, 0x00, 0x75, 0x42, 0x3b, + 0x06, 0x54, 0x11, 0x50, 0xd5, 0xf5, 0x4b,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e, 0x00, 0x00, } diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index c50f6bfcef7..1370446fb92 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -231,47 +231,6 @@ func request_ABitOfEverythingService_CreateBody_0(ctx context.Context, marshaler } -func request_ABitOfEverythingService_BulkCreate_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var metadata runtime.ServerMetadata - stream, err := client.BulkCreate(ctx) - if err != nil { - grpclog.Printf("Failed to start streaming: %v", err) - return nil, metadata, err - } - dec := marshaler.NewDecoder(req.Body) - for { - var protoReq ABitOfEverything - err = dec.Decode(&protoReq) - if err == io.EOF { - break - } - if err != nil { - grpclog.Printf("Failed to decode request: %v", err) - return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) - } - if err = stream.Send(&protoReq); err != nil { - grpclog.Printf("Failed to send request: %v", err) - return nil, metadata, err - } - } - - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) - return nil, metadata, err - } - header, err := stream.Header() - if err != nil { - grpclog.Printf("Failed to get header from client: %v", err) - return nil, metadata, err - } - metadata.HeaderMD = header - - msg, err := stream.CloseAndRecv() - metadata.TrailerMD = stream.Trailer() - return msg, metadata, err - -} - func request_ABitOfEverythingService_Lookup_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub2.IdMessage var metadata runtime.ServerMetadata @@ -299,23 +258,6 @@ func request_ABitOfEverythingService_Lookup_0(ctx context.Context, marshaler run } -func request_ABitOfEverythingService_List_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (ABitOfEverythingService_ListClient, runtime.ServerMetadata, error) { - var protoReq EmptyMessage - var metadata runtime.ServerMetadata - - stream, err := client.List(ctx, &protoReq) - if err != nil { - return nil, metadata, err - } - header, err := stream.Header() - if err != nil { - return nil, metadata, err - } - metadata.HeaderMD = header - return stream, metadata, nil - -} - func request_ABitOfEverythingService_Update_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata @@ -431,52 +373,6 @@ func request_ABitOfEverythingService_Echo_2(ctx context.Context, marshaler runti } -func request_ABitOfEverythingService_BulkEcho_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (ABitOfEverythingService_BulkEchoClient, runtime.ServerMetadata, error) { - var metadata runtime.ServerMetadata - stream, err := client.BulkEcho(ctx) - if err != nil { - grpclog.Printf("Failed to start streaming: %v", err) - return nil, metadata, err - } - dec := marshaler.NewDecoder(req.Body) - handleSend := func() error { - var protoReq sub.StringMessage - err = dec.Decode(&protoReq) - if err != nil { - grpclog.Printf("Failed to decode request: %v", err) - return err - } - if err = stream.Send(&protoReq); err != nil { - grpclog.Printf("Failed to send request: %v", err) - return err - } - return nil - } - if err := handleSend(); err != nil { - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) - } - return nil, metadata, err - } - go func() { - for { - if err := handleSend(); err != nil { - break - } - } - if err := stream.CloseSend(); err != nil { - grpclog.Printf("Failed to terminate client stream: %v", err) - } - }() - header, err := stream.Header() - if err != nil { - grpclog.Printf("Failed to get header from client: %v", err) - return nil, metadata, err - } - metadata.HeaderMD = header - return stream, metadata, nil -} - func request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ABitOfEverything var metadata runtime.ServerMetadata @@ -603,34 +499,6 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }) - mux.Handle("POST", pattern_ABitOfEverythingService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) - defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) - if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) - } - resp, md, err := request_ABitOfEverythingService_BulkCreate_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) - return - } - - forward_ABitOfEverythingService_BulkCreate_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_ABitOfEverythingService_Lookup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -659,34 +527,6 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }) - mux.Handle("GET", pattern_ABitOfEverythingService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) - defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) - if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) - } - resp, md, err := request_ABitOfEverythingService_List_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) - return - } - - forward_ABitOfEverythingService_List_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("PUT", pattern_ABitOfEverythingService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -827,34 +667,6 @@ func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.Se }) - mux.Handle("POST", pattern_ABitOfEverythingService_BulkEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) - defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, req) - if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) - } - resp, md, err := request_ABitOfEverythingService_BulkEcho_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, outboundMarshaler, w, req, err) - return - } - - forward_ABitOfEverythingService_BulkEcho_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("POST", pattern_ABitOfEverythingService_DeepPathEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -919,12 +731,8 @@ var ( pattern_ABitOfEverythingService_CreateBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, "")) - pattern_ABitOfEverythingService_BulkCreate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "a_bit_of_everything", "bulk"}, "")) - pattern_ABitOfEverythingService_Lookup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) - pattern_ABitOfEverythingService_List_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, "")) - pattern_ABitOfEverythingService_Update_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) pattern_ABitOfEverythingService_Delete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) @@ -935,8 +743,6 @@ var ( pattern_ABitOfEverythingService_Echo_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo"}, "")) - pattern_ABitOfEverythingService_BulkEcho_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "a_bit_of_everything", "echo"}, "")) - pattern_ABitOfEverythingService_DeepPathEcho_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "single_nested.name"}, "")) pattern_ABitOfEverythingService_Timeout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "timeout"}, "")) @@ -947,12 +753,8 @@ var ( forward_ABitOfEverythingService_CreateBody_0 = runtime.ForwardResponseMessage - forward_ABitOfEverythingService_BulkCreate_0 = runtime.ForwardResponseMessage - forward_ABitOfEverythingService_Lookup_0 = runtime.ForwardResponseMessage - forward_ABitOfEverythingService_List_0 = runtime.ForwardResponseStream - forward_ABitOfEverythingService_Update_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Delete_0 = runtime.ForwardResponseMessage @@ -963,8 +765,6 @@ var ( forward_ABitOfEverythingService_Echo_2 = runtime.ForwardResponseMessage - forward_ABitOfEverythingService_BulkEcho_0 = runtime.ForwardResponseStream - forward_ABitOfEverythingService_DeepPathEcho_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Timeout_0 = runtime.ForwardResponseMessage diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index ed1154642d0..1ebfc631bdf 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -9,11 +9,16 @@ import "examples/sub2/message.proto"; // Intentionaly complicated message type to cover much features of Protobuf. // NEXT ID: 27 message ABitOfEverything { + // Nested is nested type. message Nested { + // name is nested field. string name = 1; uint32 amount = 2; + // DeepEnum is one or zero. enum DeepEnum { + // FALSE is false. FALSE = 0; + // TRUE is true. TRUE = 1; } DeepEnum ok = 3; @@ -54,9 +59,12 @@ message ABitOfEverything { message EmptyMessage { } +// NumericEnum is one or zero. enum NumericEnum { + // ZERO means 0 ZERO = 0; - ONE = 1; + // ONE means 1 + ONE = 1; } service ABitOfEverythingService { @@ -72,22 +80,11 @@ service ABitOfEverythingService { body: "*" }; } - rpc BulkCreate(stream ABitOfEverything) returns (EmptyMessage) { - option (google.api.http) = { - post: "/v1/example/a_bit_of_everything/bulk" - body: "*" - }; - } rpc Lookup(sub2.IdMessage) returns (ABitOfEverything) { option (google.api.http) = { get: "/v1/example/a_bit_of_everything/{uuid}" }; } - rpc List(EmptyMessage) returns (stream ABitOfEverything) { - option (google.api.http) = { - get: "/v1/example/a_bit_of_everything" - }; - } rpc Update(ABitOfEverything) returns (EmptyMessage) { option (google.api.http) = { put: "/v1/example/a_bit_of_everything/{uuid}" @@ -111,12 +108,6 @@ service ABitOfEverythingService { } }; } - rpc BulkEcho(stream gengo.grpc.gateway.examples.sub.StringMessage) returns (stream gengo.grpc.gateway.examples.sub.StringMessage) { - option (google.api.http) = { - post: "/v1/example/a_bit_of_everything/echo" - body: "*" - }; - } rpc DeepPathEcho(ABitOfEverything) returns (ABitOfEverything) { option (google.api.http) = { post: "/v1/example/a_bit_of_everything/{single_nested.name}" diff --git a/examples/examplepb/streamless_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json similarity index 94% rename from examples/examplepb/streamless_everything.swagger.json rename to examples/examplepb/a_bit_of_everything.swagger.json index d16aa6b16d4..e1ccff0b9da 100644 --- a/examples/examplepb/streamless_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "title": "examples/examplepb/streamless_everything.proto", + "title": "examples/examplepb/a_bit_of_everything.proto", "version": "version not set" }, "schemes": [ @@ -16,20 +16,6 @@ ], "paths": { "/v1/example/a_bit_of_everything": { - "get": { - "operationId": "List", - "responses": { - "200": { - "description": "Description", - "schema": { - "$ref": "#/definitions/examplepbABitOfEverything" - } - } - }, - "tags": [ - "ABitOfEverythingService" - ] - }, "post": { "operationId": "CreateBody", "responses": { @@ -55,58 +41,6 @@ ] } }, - "/v1/example/a_bit_of_everything/bulk": { - "post": { - "operationId": "BulkCreate", - "responses": { - "200": { - "description": "Description", - "schema": { - "$ref": "#/definitions/examplepbEmptyMessage" - } - } - }, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/examplepbABitOfEverything" - } - } - ], - "tags": [ - "ABitOfEverythingService" - ] - } - }, - "/v1/example/a_bit_of_everything/echo": { - "post": { - "operationId": "BulkEcho", - "responses": { - "200": { - "description": "Description", - "schema": { - "$ref": "#/definitions/subStringMessage" - } - } - }, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/subStringMessage" - } - } - ], - "tags": [ - "ABitOfEverythingService" - ] - } - }, "/v1/example/a_bit_of_everything/echo/{value}": { "get": { "operationId": "Echo", @@ -366,6 +300,62 @@ "ABitOfEverythingService" ] } + }, + "/v2/example/echo": { + "get": { + "operationId": "Echo", + "responses": { + "200": { + "description": "Description", + "schema": { + "$ref": "#/definitions/subStringMessage" + } + } + }, + "tags": [ + "ABitOfEverythingService" + ] + }, + "post": { + "operationId": "Echo", + "responses": { + "200": { + "description": "Description", + "schema": { + "$ref": "#/definitions/subStringMessage" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/subStringMessage" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, + "/v2/example/timeout": { + "get": { + "operationId": "Timeout", + "responses": { + "200": { + "description": "Description", + "schema": { + "$ref": "#/definitions/examplepbEmptyMessage" + } + } + }, + "tags": [ + "ABitOfEverythingService" + ] + } } }, "definitions": { @@ -515,16 +505,6 @@ "examplepbEmptyMessage": { "type": "object" }, - "examplepbIdMessage": { - "type": "object", - "properties": { - "uuid": { - "type": "string", - "format": "string", - "title": "uuid is UUID value" - } - } - }, "examplepbNumericEnum": { "type": "string", "enum": [ @@ -534,6 +514,15 @@ "default": "ZERO", "description": "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1" }, + "sub2IdMessage": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "format": "string" + } + } + }, "subStringMessage": { "type": "object", "properties": { diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 68e395dc7fa..35da7c4206e 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -13,6 +13,7 @@ a message. It is generated from these files: examples/examplepb/echo_service.proto examples/examplepb/a_bit_of_everything.proto + examples/examplepb/stream.proto examples/examplepb/flow_combination.proto It has these top-level messages: diff --git a/examples/examplepb/flow_combination.pb.go b/examples/examplepb/flow_combination.pb.go index a924a96dc04..5a82086ffb8 100644 --- a/examples/examplepb/flow_combination.pb.go +++ b/examples/examplepb/flow_combination.pb.go @@ -25,7 +25,7 @@ type EmptyProto struct { func (m *EmptyProto) Reset() { *m = EmptyProto{} } func (m *EmptyProto) String() string { return proto.CompactTextString(m) } func (*EmptyProto) ProtoMessage() {} -func (*EmptyProto) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } +func (*EmptyProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} } type NonEmptyProto struct { A string `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` @@ -36,7 +36,7 @@ type NonEmptyProto struct { func (m *NonEmptyProto) Reset() { *m = NonEmptyProto{} } func (m *NonEmptyProto) String() string { return proto.CompactTextString(m) } func (*NonEmptyProto) ProtoMessage() {} -func (*NonEmptyProto) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} } +func (*NonEmptyProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} } type UnaryProto struct { Str string `protobuf:"bytes,1,opt,name=str" json:"str,omitempty"` @@ -45,7 +45,7 @@ type UnaryProto struct { func (m *UnaryProto) Reset() { *m = UnaryProto{} } func (m *UnaryProto) String() string { return proto.CompactTextString(m) } func (*UnaryProto) ProtoMessage() {} -func (*UnaryProto) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{2} } +func (*UnaryProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{2} } type NestedProto struct { A *UnaryProto `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"` @@ -56,7 +56,7 @@ type NestedProto struct { func (m *NestedProto) Reset() { *m = NestedProto{} } func (m *NestedProto) String() string { return proto.CompactTextString(m) } func (*NestedProto) ProtoMessage() {} -func (*NestedProto) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{3} } +func (*NestedProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{3} } func (m *NestedProto) GetA() *UnaryProto { if m != nil { @@ -72,7 +72,7 @@ type SingleNestedProto struct { func (m *SingleNestedProto) Reset() { *m = SingleNestedProto{} } func (m *SingleNestedProto) String() string { return proto.CompactTextString(m) } func (*SingleNestedProto) ProtoMessage() {} -func (*SingleNestedProto) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{4} } +func (*SingleNestedProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{4} } func (m *SingleNestedProto) GetA() *UnaryProto { if m != nil { @@ -632,9 +632,9 @@ var _FlowCombination_serviceDesc = grpc.ServiceDesc{ }, } -func init() { proto.RegisterFile("examples/examplepb/flow_combination.proto", fileDescriptor2) } +func init() { proto.RegisterFile("examples/examplepb/flow_combination.proto", fileDescriptor3) } -var fileDescriptor2 = []byte{ +var fileDescriptor3 = []byte{ // 658 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x96, 0xbf, 0x6f, 0xd3, 0x40, 0x14, 0xc7, 0x75, 0xa9, 0x84, 0xd4, 0x4b, 0x53, 0x52, 0x07, 0x85, 0x24, 0x84, 0xfe, 0x38, 0x8a, diff --git a/examples/examplepb/stream.pb.go b/examples/examplepb/stream.pb.go new file mode 100644 index 00000000000..3a8bd19e22c --- /dev/null +++ b/examples/examplepb/stream.pb.go @@ -0,0 +1,277 @@ +// Code generated by protoc-gen-go. +// source: examples/examplepb/stream.proto +// DO NOT EDIT! + +package examplepb + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gengo/grpc-gateway/third_party/googleapis/google/api" +import gengo_grpc_gateway_examples_sub "github.com/gengo/grpc-gateway/examples/sub" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion2 + +// Client API for StreamService service + +type StreamServiceClient interface { + BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error) + List(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (StreamService_ListClient, error) + BulkEcho(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkEchoClient, error) +} + +type streamServiceClient struct { + cc *grpc.ClientConn +} + +func NewStreamServiceClient(cc *grpc.ClientConn) StreamServiceClient { + return &streamServiceClient{cc} +} + +func (c *streamServiceClient) BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error) { + stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[0], c.cc, "/gengo.grpc.gateway.examples.examplepb.StreamService/BulkCreate", opts...) + if err != nil { + return nil, err + } + x := &streamServiceBulkCreateClient{stream} + return x, nil +} + +type StreamService_BulkCreateClient interface { + Send(*ABitOfEverything) error + CloseAndRecv() (*EmptyMessage, error) + grpc.ClientStream +} + +type streamServiceBulkCreateClient struct { + grpc.ClientStream +} + +func (x *streamServiceBulkCreateClient) Send(m *ABitOfEverything) error { + return x.ClientStream.SendMsg(m) +} + +func (x *streamServiceBulkCreateClient) CloseAndRecv() (*EmptyMessage, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(EmptyMessage) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *streamServiceClient) List(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (StreamService_ListClient, error) { + stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[1], c.cc, "/gengo.grpc.gateway.examples.examplepb.StreamService/List", opts...) + if err != nil { + return nil, err + } + x := &streamServiceListClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type StreamService_ListClient interface { + Recv() (*ABitOfEverything, error) + grpc.ClientStream +} + +type streamServiceListClient struct { + grpc.ClientStream +} + +func (x *streamServiceListClient) Recv() (*ABitOfEverything, error) { + m := new(ABitOfEverything) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *streamServiceClient) BulkEcho(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkEchoClient, error) { + stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[2], c.cc, "/gengo.grpc.gateway.examples.examplepb.StreamService/BulkEcho", opts...) + if err != nil { + return nil, err + } + x := &streamServiceBulkEchoClient{stream} + return x, nil +} + +type StreamService_BulkEchoClient interface { + Send(*gengo_grpc_gateway_examples_sub.StringMessage) error + Recv() (*gengo_grpc_gateway_examples_sub.StringMessage, error) + grpc.ClientStream +} + +type streamServiceBulkEchoClient struct { + grpc.ClientStream +} + +func (x *streamServiceBulkEchoClient) Send(m *gengo_grpc_gateway_examples_sub.StringMessage) error { + return x.ClientStream.SendMsg(m) +} + +func (x *streamServiceBulkEchoClient) Recv() (*gengo_grpc_gateway_examples_sub.StringMessage, error) { + m := new(gengo_grpc_gateway_examples_sub.StringMessage) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for StreamService service + +type StreamServiceServer interface { + BulkCreate(StreamService_BulkCreateServer) error + List(*EmptyMessage, StreamService_ListServer) error + BulkEcho(StreamService_BulkEchoServer) error +} + +func RegisterStreamServiceServer(s *grpc.Server, srv StreamServiceServer) { + s.RegisterService(&_StreamService_serviceDesc, srv) +} + +func _StreamService_BulkCreate_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(StreamServiceServer).BulkCreate(&streamServiceBulkCreateServer{stream}) +} + +type StreamService_BulkCreateServer interface { + SendAndClose(*EmptyMessage) error + Recv() (*ABitOfEverything, error) + grpc.ServerStream +} + +type streamServiceBulkCreateServer struct { + grpc.ServerStream +} + +func (x *streamServiceBulkCreateServer) SendAndClose(m *EmptyMessage) error { + return x.ServerStream.SendMsg(m) +} + +func (x *streamServiceBulkCreateServer) Recv() (*ABitOfEverything, error) { + m := new(ABitOfEverything) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _StreamService_List_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(EmptyMessage) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(StreamServiceServer).List(m, &streamServiceListServer{stream}) +} + +type StreamService_ListServer interface { + Send(*ABitOfEverything) error + grpc.ServerStream +} + +type streamServiceListServer struct { + grpc.ServerStream +} + +func (x *streamServiceListServer) Send(m *ABitOfEverything) error { + return x.ServerStream.SendMsg(m) +} + +func _StreamService_BulkEcho_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(StreamServiceServer).BulkEcho(&streamServiceBulkEchoServer{stream}) +} + +type StreamService_BulkEchoServer interface { + Send(*gengo_grpc_gateway_examples_sub.StringMessage) error + Recv() (*gengo_grpc_gateway_examples_sub.StringMessage, error) + grpc.ServerStream +} + +type streamServiceBulkEchoServer struct { + grpc.ServerStream +} + +func (x *streamServiceBulkEchoServer) Send(m *gengo_grpc_gateway_examples_sub.StringMessage) error { + return x.ServerStream.SendMsg(m) +} + +func (x *streamServiceBulkEchoServer) Recv() (*gengo_grpc_gateway_examples_sub.StringMessage, error) { + m := new(gengo_grpc_gateway_examples_sub.StringMessage) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _StreamService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "gengo.grpc.gateway.examples.examplepb.StreamService", + HandlerType: (*StreamServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "BulkCreate", + Handler: _StreamService_BulkCreate_Handler, + ClientStreams: true, + }, + { + StreamName: "List", + Handler: _StreamService_List_Handler, + ServerStreams: true, + }, + { + StreamName: "BulkEcho", + Handler: _StreamService_BulkEcho_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, +} + +func init() { proto.RegisterFile("examples/examplepb/stream.proto", fileDescriptor2) } + +var fileDescriptor2 = []byte{ + // 306 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xad, 0x48, 0xcc, + 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x87, 0x32, 0x0a, 0x92, 0xf4, 0x8b, 0x4b, 0x8a, 0x52, 0x13, 0x73, + 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x54, 0xd3, 0x53, 0xf3, 0xd2, 0xf3, 0xf5, 0xd2, 0x8b, + 0x0a, 0x92, 0xf5, 0xd2, 0x13, 0x4b, 0x52, 0xcb, 0x13, 0x2b, 0xf5, 0x60, 0x7a, 0xf4, 0xe0, 0x7a, + 0xa4, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, + 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0x86, 0x48, 0xe9, 0x60, 0xb1, 0x25, 0x31, + 0x3e, 0x29, 0xb3, 0x24, 0x3e, 0x3f, 0x2d, 0x3e, 0xb5, 0x2c, 0xb5, 0xa8, 0xb2, 0x24, 0x23, 0x33, + 0x2f, 0x1d, 0xaa, 0x5a, 0x0a, 0xae, 0xba, 0xb8, 0x34, 0x49, 0x3f, 0x37, 0xb5, 0xb8, 0x38, 0x31, + 0x3d, 0x15, 0x22, 0x67, 0xd4, 0xcc, 0xc2, 0xc5, 0x1b, 0x0c, 0x76, 0x5f, 0x70, 0x6a, 0x51, 0x59, + 0x66, 0x72, 0xaa, 0xd0, 0x5a, 0x46, 0x2e, 0x2e, 0xa7, 0xd2, 0x9c, 0x6c, 0x67, 0xa0, 0x60, 0x49, + 0xaa, 0x90, 0xb9, 0x1e, 0x51, 0x0e, 0xd6, 0x73, 0x74, 0xca, 0x2c, 0xf1, 0x4f, 0x73, 0x85, 0xdb, + 0x2d, 0x65, 0x4c, 0xa4, 0x46, 0xd7, 0xdc, 0x82, 0x92, 0x4a, 0x5f, 0x88, 0xa3, 0x94, 0xf4, 0x9b, + 0x2e, 0x3f, 0x99, 0xcc, 0xa4, 0xa9, 0xa4, 0xa2, 0x5f, 0x66, 0x08, 0xf3, 0x1b, 0x36, 0x9f, 0xe9, + 0x27, 0x01, 0x5d, 0x68, 0xc5, 0xa8, 0xa5, 0xc1, 0x28, 0x34, 0x9f, 0x91, 0x8b, 0xc5, 0x27, 0xb3, + 0xb8, 0x44, 0x88, 0x1c, 0x0b, 0xa5, 0xc8, 0xf5, 0x9e, 0x92, 0x3a, 0xd8, 0xa5, 0x8a, 0x42, 0xf2, + 0x04, 0x5c, 0x6a, 0x00, 0x76, 0x21, 0x07, 0x28, 0x44, 0x5d, 0x93, 0x33, 0xf2, 0x85, 0xf4, 0xf0, + 0x5a, 0x08, 0x8c, 0x20, 0x3d, 0x60, 0x74, 0x00, 0xf5, 0xc1, 0x1c, 0x48, 0xa2, 0x7a, 0xe2, 0x43, + 0x30, 0x15, 0xe8, 0x1a, 0x70, 0x08, 0x1a, 0x30, 0x3a, 0x71, 0x47, 0x71, 0xc2, 0xbd, 0x9a, 0xc4, + 0x06, 0x4e, 0x19, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x53, 0xd5, 0x72, 0xcb, 0x02, + 0x00, 0x00, +} diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go new file mode 100644 index 00000000000..f5bd60cea06 --- /dev/null +++ b/examples/examplepb/stream.pb.gw.go @@ -0,0 +1,266 @@ +// Code generated by protoc-gen-grpc-gateway +// source: examples/examplepb/stream.proto +// DO NOT EDIT! + +/* +Package examplepb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package examplepb + +import ( + "io" + "net/http" + + "github.com/gengo/grpc-gateway/examples/sub" + "github.com/gengo/grpc-gateway/runtime" + "github.com/gengo/grpc-gateway/utilities" + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" +) + +var _ codes.Code +var _ io.Reader +var _ = runtime.String +var _ = utilities.NewDoubleArray + +func request_StreamService_BulkCreate_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var metadata runtime.ServerMetadata + stream, err := client.BulkCreate(ctx) + if err != nil { + grpclog.Printf("Failed to start streaming: %v", err) + return nil, metadata, err + } + dec := marshaler.NewDecoder(req.Body) + for { + var protoReq ABitOfEverything + err = dec.Decode(&protoReq) + if err == io.EOF { + break + } + if err != nil { + grpclog.Printf("Failed to decode request: %v", err) + return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) + } + if err = stream.Send(&protoReq); err != nil { + grpclog.Printf("Failed to send request: %v", err) + return nil, metadata, err + } + } + + if err := stream.CloseSend(); err != nil { + grpclog.Printf("Failed to terminate client stream: %v", err) + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + grpclog.Printf("Failed to get header from client: %v", err) + return nil, metadata, err + } + metadata.HeaderMD = header + + msg, err := stream.CloseAndRecv() + metadata.TrailerMD = stream.Trailer() + return msg, metadata, err + +} + +func request_StreamService_List_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (StreamService_ListClient, runtime.ServerMetadata, error) { + var protoReq EmptyMessage + var metadata runtime.ServerMetadata + + stream, err := client.List(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (StreamService_BulkEchoClient, runtime.ServerMetadata, error) { + var metadata runtime.ServerMetadata + stream, err := client.BulkEcho(ctx) + if err != nil { + grpclog.Printf("Failed to start streaming: %v", err) + return nil, metadata, err + } + dec := marshaler.NewDecoder(req.Body) + handleSend := func() error { + var protoReq sub.StringMessage + err = dec.Decode(&protoReq) + if err != nil { + grpclog.Printf("Failed to decode request: %v", err) + return err + } + if err = stream.Send(&protoReq); err != nil { + grpclog.Printf("Failed to send request: %v", err) + return err + } + return nil + } + if err := handleSend(); err != nil { + if err := stream.CloseSend(); err != nil { + grpclog.Printf("Failed to terminate client stream: %v", err) + } + return nil, metadata, err + } + go func() { + for { + if err := handleSend(); err != nil { + break + } + } + if err := stream.CloseSend(); err != nil { + grpclog.Printf("Failed to terminate client stream: %v", err) + } + }() + header, err := stream.Header() + if err != nil { + grpclog.Printf("Failed to get header from client: %v", err) + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil +} + +// RegisterStreamServiceHandlerFromEndpoint is same as RegisterStreamServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterStreamServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterStreamServiceHandler(ctx, mux, conn) +} + +// RegisterStreamServiceHandler registers the http handlers for service StreamService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterStreamServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + client := NewStreamServiceClient(conn) + + mux.Handle("POST", pattern_StreamService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_StreamService_BulkCreate_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_StreamService_BulkCreate_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_StreamService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_StreamService_List_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_StreamService_List_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_StreamService_BulkEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_StreamService_BulkEcho_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_StreamService_BulkEcho_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_StreamService_BulkCreate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "a_bit_of_everything", "bulk"}, "")) + + pattern_StreamService_List_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, "")) + + pattern_StreamService_BulkEcho_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "a_bit_of_everything", "echo"}, "")) +) + +var ( + forward_StreamService_BulkCreate_0 = runtime.ForwardResponseMessage + + forward_StreamService_List_0 = runtime.ForwardResponseStream + + forward_StreamService_BulkEcho_0 = runtime.ForwardResponseStream +) diff --git a/examples/examplepb/stream.proto b/examples/examplepb/stream.proto new file mode 100644 index 00000000000..989bbf01480 --- /dev/null +++ b/examples/examplepb/stream.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +option go_package = "examplepb"; +package gengo.grpc.gateway.examples.examplepb; + +import "google/api/annotations.proto"; +import "examples/examplepb/a_bit_of_everything.proto"; +import "examples/sub/message.proto"; + +// Defines some more operations to be added to ABitOfEverythingService +service StreamService { + rpc BulkCreate(stream ABitOfEverything) returns (EmptyMessage) { + option (google.api.http) = { + post: "/v1/example/a_bit_of_everything/bulk" + body: "*" + }; + } + rpc List(EmptyMessage) returns (stream ABitOfEverything) { + option (google.api.http) = { + get: "/v1/example/a_bit_of_everything" + }; + } + rpc BulkEcho(stream gengo.grpc.gateway.examples.sub.StringMessage) returns (stream gengo.grpc.gateway.examples.sub.StringMessage) { + option (google.api.http) = { + post: "/v1/example/a_bit_of_everything/echo" + body: "*" + }; + } +} diff --git a/examples/examplepb/streamless_everything.proto b/examples/examplepb/streamless_everything.proto deleted file mode 100644 index 8284826646f..00000000000 --- a/examples/examplepb/streamless_everything.proto +++ /dev/null @@ -1,138 +0,0 @@ -syntax = "proto3"; -option go_package = "examplepb"; -package gengo.grpc.gateway.examples.examplepb; - -import "google/api/annotations.proto"; -import "examples/sub/message.proto"; - -// Intentionaly complicated message type to cover much features of Protobuf. -// NEXT ID: 27 -message ABitOfEverything { - // Nested is nested type. - message Nested { - // name is nested field. - string name = 1; - uint32 amount = 2; - // DeepEnum is one or zero. - enum DeepEnum { - // FALSE is false. - FALSE = 0; - // TRUE is true. - TRUE = 1; - } - DeepEnum ok = 3; - } - Nested single_nested = 25; - - string uuid = 1; - repeated Nested nested = 2; - float float_value = 3; - double double_value = 4; - int64 int64_value = 5; - uint64 uint64_value = 6; - int32 int32_value = 7; - fixed64 fixed64_value = 8; - fixed32 fixed32_value = 9; - bool bool_value = 10; - string string_value = 11; - // TODO(yugui) add bytes_value - uint32 uint32_value = 13; - NumericEnum enum_value = 14; - sfixed32 sfixed32_value = 15; - sfixed64 sfixed64_value = 16; - sint32 sint32_value = 17; - sint64 sint64_value = 18; - repeated string repeated_string_value = 19; - oneof oneof_value { - EmptyMessage oneof_empty = 20; - string oneof_string = 21; - } - - map map_value = 22; - map mapped_string_value = 23; - map mapped_nested_value = 24; - - string nonConventionalNameValue = 26; -} - -message EmptyMessage { -} - -message IdMessage { - // uuid is UUID value - string uuid = 1; -} - -// NumericEnum is one or zero. -enum NumericEnum { - // ZERO means 0 - ZERO = 0; - // ONE means 1 - ONE = 1; -} - -service ABitOfEverythingService { - rpc Create(ABitOfEverything) returns (ABitOfEverything) { - // TODO add enum_value - option (google.api.http) = { - post: "/v1/example/a_bit_of_everything/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value=strprefix/*}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}" - }; - } - rpc CreateBody(ABitOfEverything) returns (ABitOfEverything) { - option (google.api.http) = { - post: "/v1/example/a_bit_of_everything" - body: "*" - }; - } - rpc BulkCreate(ABitOfEverything) returns (EmptyMessage) { - option (google.api.http) = { - post: "/v1/example/a_bit_of_everything/bulk" - body: "*" - }; - } - rpc Lookup(IdMessage) returns (ABitOfEverything) { - option (google.api.http) = { - get: "/v1/example/a_bit_of_everything/{uuid}" - }; - } - rpc List(EmptyMessage) returns (ABitOfEverything) { - option (google.api.http) = { - get: "/v1/example/a_bit_of_everything" - }; - } - rpc Update(ABitOfEverything) returns (EmptyMessage) { - option (google.api.http) = { - put: "/v1/example/a_bit_of_everything/{uuid}" - body: "*" - }; - } - rpc Delete(IdMessage) returns (EmptyMessage) { - option (google.api.http) = { - delete: "/v1/example/a_bit_of_everything/{uuid}" - }; - } - rpc Echo(gengo.grpc.gateway.examples.sub.StringMessage) returns (gengo.grpc.gateway.examples.sub.StringMessage) { - option (google.api.http) = { - get: "/v1/example/a_bit_of_everything/echo/{value}" - //additional_bindings { - // post: "/v2/example/echo" - // body: "value" - //} - //additional_bindings { - // get: "/v2/example/echo" - //} - }; - } - rpc BulkEcho(gengo.grpc.gateway.examples.sub.StringMessage) returns (gengo.grpc.gateway.examples.sub.StringMessage) { - option (google.api.http) = { - post: "/v1/example/a_bit_of_everything/echo" - body: "*" - }; - } - rpc DeepPathEcho(ABitOfEverything) returns (ABitOfEverything) { - option (google.api.http) = { - post: "/v1/example/a_bit_of_everything/{single_nested.name}" - body: "*" - }; - } -} diff --git a/examples/main.go b/examples/main.go index 94c80fc63eb..f9111c9d93b 100644 --- a/examples/main.go +++ b/examples/main.go @@ -28,6 +28,10 @@ func Run(address string, opts ...runtime.ServeMuxOption) error { if err != nil { return err } + err = examplepb.RegisterStreamServiceHandlerFromEndpoint(ctx, mux, *abeEndpoint, dialOpts) + if err != nil { + return err + } err = examplepb.RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx, mux, *abeEndpoint, dialOpts) if err != nil { return err diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 16ebf8e8b07..5027e01e77d 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -25,7 +25,12 @@ type _ABitOfEverythingServer struct { m sync.Mutex } -func newABitOfEverythingServer() examples.ABitOfEverythingServiceServer { +type ABitOfEverythingServer interface { + examples.ABitOfEverythingServiceServer + examples.StreamServiceServer +} + +func newABitOfEverythingServer() ABitOfEverythingServer { return &_ABitOfEverythingServer{ v: make(map[string]*examples.ABitOfEverything), } @@ -53,7 +58,7 @@ func (s *_ABitOfEverythingServer) CreateBody(ctx context.Context, msg *examples. return s.Create(ctx, msg) } -func (s *_ABitOfEverythingServer) BulkCreate(stream examples.ABitOfEverythingService_BulkCreateServer) error { +func (s *_ABitOfEverythingServer) BulkCreate(stream examples.StreamService_BulkCreateServer) error { count := 0 ctx := stream.Context() for { @@ -108,7 +113,7 @@ func (s *_ABitOfEverythingServer) Lookup(ctx context.Context, msg *sub2.IdMessag return nil, grpc.Errorf(codes.NotFound, "not found") } -func (s *_ABitOfEverythingServer) List(_ *examples.EmptyMessage, stream examples.ABitOfEverythingService_ListServer) error { +func (s *_ABitOfEverythingServer) List(_ *examples.EmptyMessage, stream examples.StreamService_ListServer) error { s.m.Lock() defer s.m.Unlock() @@ -172,7 +177,7 @@ func (s *_ABitOfEverythingServer) Echo(ctx context.Context, msg *sub.StringMessa return msg, nil } -func (s *_ABitOfEverythingServer) BulkEcho(stream examples.ABitOfEverythingService_BulkEchoServer) error { +func (s *_ABitOfEverythingServer) BulkEcho(stream examples.StreamService_BulkEchoServer) error { var msgs []*sub.StringMessage for { msg, err := stream.Recv() diff --git a/examples/server/main.go b/examples/server/main.go index c08115aad55..844ace623e3 100644 --- a/examples/server/main.go +++ b/examples/server/main.go @@ -16,8 +16,12 @@ func Run() error { } s := grpc.NewServer() examples.RegisterEchoServiceServer(s, newEchoServer()) - examples.RegisterABitOfEverythingServiceServer(s, newABitOfEverythingServer()) examples.RegisterFlowCombinationServer(s, newFlowCombinationServer()) + + abe := newABitOfEverythingServer() + examples.RegisterABitOfEverythingServiceServer(s, abe) + examples.RegisterStreamServiceServer(s, abe) + s.Serve(l) return nil } From 7aec59cc311f4528d1a9d5b64d6020453ca97ca9 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Mon, 13 Jun 2016 18:07:26 +0900 Subject: [PATCH 2/2] Use google.protobuf.Empty instead of our own --- examples/examplepb/a_bit_of_everything.pb.go | 190 +++++++++--------- .../examplepb/a_bit_of_everything.pb.gw.go | 3 +- examples/examplepb/a_bit_of_everything.proto | 12 +- .../a_bit_of_everything.swagger.json | 16 +- examples/examplepb/echo_service.pb.go | 1 - examples/examplepb/stream.pb.go | 61 +++--- examples/examplepb/stream.pb.gw.go | 3 +- examples/examplepb/stream.proto | 5 +- examples/integration_test.go | 3 +- examples/server/a_bit_of_everything.go | 15 +- 10 files changed, 153 insertions(+), 156 deletions(-) diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index 09f9274cdce..0cc2f023fc1 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -8,6 +8,7 @@ import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gengo/grpc-gateway/third_party/googleapis/google/api" +import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" import gengo_grpc_gateway_examples_sub "github.com/gengo/grpc-gateway/examples/sub" import sub2 "github.com/gengo/grpc-gateway/examples/sub2" @@ -114,7 +115,7 @@ type isABitOfEverything_OneofValue interface { } type ABitOfEverything_OneofEmpty struct { - OneofEmpty *EmptyMessage `protobuf:"bytes,20,opt,name=oneof_empty,json=oneofEmpty,oneof"` + OneofEmpty *google_protobuf1.Empty `protobuf:"bytes,20,opt,name=oneof_empty,json=oneofEmpty,oneof"` } type ABitOfEverything_OneofString struct { OneofString string `protobuf:"bytes,21,opt,name=oneof_string,json=oneofString,oneof"` @@ -144,7 +145,7 @@ func (m *ABitOfEverything) GetNested() []*ABitOfEverything_Nested { return nil } -func (m *ABitOfEverything) GetOneofEmpty() *EmptyMessage { +func (m *ABitOfEverything) GetOneofEmpty() *google_protobuf1.Empty { if x, ok := m.GetOneofValue().(*ABitOfEverything_OneofEmpty); ok { return x.OneofEmpty } @@ -213,7 +214,7 @@ func _ABitOfEverything_OneofUnmarshaler(msg proto.Message, tag, wire int, b *pro if wire != proto.WireBytes { return true, proto.ErrInternalBadWireType } - msg := new(EmptyMessage) + msg := new(google_protobuf1.Empty) err := b.DecodeMessage(msg) m.OneofValue = &ABitOfEverything_OneofEmpty{msg} return true, err @@ -262,18 +263,9 @@ func (m *ABitOfEverything_Nested) String() string { return proto.Comp func (*ABitOfEverything_Nested) ProtoMessage() {} func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0, 0} } -type EmptyMessage struct { -} - -func (m *EmptyMessage) Reset() { *m = EmptyMessage{} } -func (m *EmptyMessage) String() string { return proto.CompactTextString(m) } -func (*EmptyMessage) ProtoMessage() {} -func (*EmptyMessage) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } - func init() { proto.RegisterType((*ABitOfEverything)(nil), "gengo.grpc.gateway.examples.examplepb.ABitOfEverything") proto.RegisterType((*ABitOfEverything_Nested)(nil), "gengo.grpc.gateway.examples.examplepb.ABitOfEverything.Nested") - proto.RegisterType((*EmptyMessage)(nil), "gengo.grpc.gateway.examples.examplepb.EmptyMessage") proto.RegisterEnum("gengo.grpc.gateway.examples.examplepb.NumericEnum", NumericEnum_name, NumericEnum_value) proto.RegisterEnum("gengo.grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum", ABitOfEverything_Nested_DeepEnum_name, ABitOfEverything_Nested_DeepEnum_value) } @@ -292,11 +284,11 @@ type ABitOfEverythingServiceClient interface { Create(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) CreateBody(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) - Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*EmptyMessage, error) - Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*EmptyMessage, error) + Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Echo(ctx context.Context, in *gengo_grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*gengo_grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) - Timeout(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*EmptyMessage, error) + Timeout(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) } type aBitOfEverythingServiceClient struct { @@ -334,8 +326,8 @@ func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdM return out, nil } -func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*EmptyMessage, error) { - out := new(EmptyMessage) +func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", in, out, c.cc, opts...) if err != nil { return nil, err @@ -343,8 +335,8 @@ func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEv return out, nil } -func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*EmptyMessage, error) { - out := new(EmptyMessage) +func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", in, out, c.cc, opts...) if err != nil { return nil, err @@ -370,8 +362,8 @@ func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *AB return out, nil } -func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (*EmptyMessage, error) { - out := new(EmptyMessage) +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, "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", in, out, c.cc, opts...) if err != nil { return nil, err @@ -385,11 +377,11 @@ type ABitOfEverythingServiceServer interface { Create(context.Context, *ABitOfEverything) (*ABitOfEverything, error) CreateBody(context.Context, *ABitOfEverything) (*ABitOfEverything, error) Lookup(context.Context, *sub2.IdMessage) (*ABitOfEverything, error) - Update(context.Context, *ABitOfEverything) (*EmptyMessage, error) - Delete(context.Context, *sub2.IdMessage) (*EmptyMessage, error) + Update(context.Context, *ABitOfEverything) (*google_protobuf1.Empty, error) + Delete(context.Context, *sub2.IdMessage) (*google_protobuf1.Empty, error) Echo(context.Context, *gengo_grpc_gateway_examples_sub.StringMessage) (*gengo_grpc_gateway_examples_sub.StringMessage, error) DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error) - Timeout(context.Context, *EmptyMessage) (*EmptyMessage, error) + Timeout(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error) } func RegisterABitOfEverythingServiceServer(s *grpc.Server, srv ABitOfEverythingServiceServer) { @@ -523,7 +515,7 @@ func _ABitOfEverythingService_DeepPathEcho_Handler(srv interface{}, ctx context. } func _ABitOfEverythingService_Timeout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(EmptyMessage) + in := new(google_protobuf1.Empty) if err := dec(in); err != nil { return nil, err } @@ -535,7 +527,7 @@ func _ABitOfEverythingService_Timeout_Handler(srv interface{}, ctx context.Conte FullMethod: "/gengo.grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ABitOfEverythingServiceServer).Timeout(ctx, req.(*EmptyMessage)) + return srv.(ABitOfEverythingServiceServer).Timeout(ctx, req.(*google_protobuf1.Empty)) } return interceptor(ctx, in, info, handler) } @@ -583,77 +575,77 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1152 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x57, 0xed, 0x6e, 0x1b, 0x45, - 0x17, 0xee, 0xda, 0x89, 0x13, 0x1f, 0x7f, 0xc4, 0x99, 0x34, 0xa9, 0xeb, 0xbe, 0xaf, 0x12, 0x0c, - 0x45, 0x55, 0xa8, 0x76, 0xd5, 0x4d, 0xc5, 0x47, 0x24, 0x40, 0x4d, 0x63, 0x28, 0x52, 0x9b, 0xc0, - 0x26, 0x0d, 0x52, 0x24, 0x64, 0xad, 0xed, 0x89, 0xb3, 0x8a, 0x77, 0x67, 0xb5, 0x1f, 0xa6, 0x56, - 0x94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x15, 0x21, 0x30, 0x15, 0x86, 0x56, 0xaf, 0xae, 0x20, 0x77, - 0xd1, 0xe0, 0xcf, 0x64, 0x0f, 0x0a, 0xb1, 0xc7, 0xdc, 0x4a, 0xfe, 0x35, 0x78, 0x8c, 0xd9, 0xc8, - 0x32, 0x94, 0x0e, 0x06, 0xcc, 0x0c, 0xda, 0x43, 0x73, 0x10, 0xd2, 0x7a, 0x1e, 0x5d, 0xe6, 0x0c, - 0xe0, 0xa6, 0xbd, 0xc8, 0x42, 0xde, 0x80, 0x72, 0x8f, 0x85, 0x1d, 0x8c, 0x58, 0x20, 0xa6, 0x10, - 0xa1, 0x18, 0x25, 0x61, 0x13, 0x10, 0xe4, 0xb0, 0x9c, 0xe0, 0xdd, 0xfb, 0x31, 0x62, 0x1a, 0x11, - 0x79, 0x03, 0xb8, 0x29, 0xe5, 0x08, 0x65, 0x44, 0x01, 0x11, 0x53, 0x46, 0x29, 0x94, 0x20, 0x82, - 0x63, 0x4d, 0x8f, 0x11, 0x33, 0x88, 0x98, 0xe6, 0x1c, 0x6b, 0xba, 0x00, 0xbc, 0x09, 0x95, 0x03, - 0xeb, 0x19, 0xed, 0xa5, 0x24, 0xb3, 0x08, 0x29, 0x18, 0xe5, 0xd8, 0x98, 0x05, 0xa5, 0x3c, 0x45, - 0x04, 0xcd, 0xc4, 0xa0, 0x84, 0xe9, 0xff, 0x00, 0x1d, 0xc6, 0x06, 0x31, 0x02, 0x10, 0x31, 0x6b, - 0x14, 0x23, 0x4b, 0x2a, 0xd6, 0x0f, 0x3c, 0x4c, 0x55, 0x0c, 0x28, 0xf1, 0x2a, 0x94, 0x84, 0x2d, - 0x13, 0x4f, 0xea, 0xa5, 0x82, 0x90, 0x8a, 0x88, 0x27, 0x71, 0xf2, 0x05, 0x00, 0x75, 0x42, 0x3b, - 0x06, 0x54, 0x11, 0x50, 0xd5, 0xf5, 0x4b, 0xd6, 0x6c, 0x2b, 0xb4, 0xa9, 0x67, 0x75, 0x5b, 0xf8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- 0xf2, 0x23, 0x8a, 0x78, 0xea, 0xf6, 0xae, 0x74, 0xbc, 0x27, 0xb9, 0x76, 0x9b, 0xf7, 0xb8, 0xd0, - 0x77, 0x1a, 0x97, 0x14, 0x1a, 0x25, 0xec, 0x39, 0x14, 0x36, 0xe9, 0x80, 0xa2, 0xd4, 0x33, 0xf9, - 0x9a, 0x48, 0x42, 0x9c, 0xab, 0xd5, 0xcb, 0xe6, 0xea, 0x37, 0x05, 0xa6, 0x5a, 0xdd, 0x43, 0x46, - 0xd4, 0xbf, 0xf5, 0x86, 0xd2, 0x54, 0x31, 0x56, 0x13, 0x75, 0xff, 0x10, 0xdf, 0xec, 0x72, 0x61, - 0x5f, 0x91, 0xbb, 0x17, 0x09, 0xa3, 0xa8, 0x46, 0x3b, 0x16, 0x7d, 0xb1, 0x7f, 0xb3, 0x59, 0xd3, - 0x86, 0x7a, 0x8a, 0x8f, 0xf6, 0xd6, 0xc5, 0x94, 0xdc, 0x27, 0xe4, 0xcc, 0x16, 0xf9, 0x45, 0x81, - 0x72, 0x74, 0x2b, 0x7d, 0x6e, 0x06, 0x87, 0x3c, 0xaa, 0x7f, 0xbf, 0x5b, 0x3e, 0xe6, 0x71, 0x7e, - 0xd0, 0xbc, 0x7f, 0x61, 0x01, 0x32, 0xff, 0x97, 0xd4, 0xe8, 0x16, 0xe7, 0x27, 0xe2, 0x5b, 0x05, - 0x66, 0x76, 0x2d, 0x9b, 0xb2, 0x30, 0x20, 0x93, 0x1c, 0x81, 0xc9, 0xce, 0xcd, 0x2d, 0x2e, 0x7b, - 0x91, 0x2c, 0xc8, 0x39, 0x0d, 0x84, 0x8c, 0x8d, 0xd2, 0x7e, 0x31, 0x7d, 0xad, 0x53, 0xe0, 0xff, - 0x02, 0xd7, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x0c, 0xd8, 0x3f, 0xb9, 0xb3, 0x0e, 0x00, 0x00, + // 1150 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0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 0xf3, 0xa0, 0x8c, 0xa7, 0x8c, 0xa0, 0xa9, 0x04, 0x94, 0x32, 0xbd, 0x0d, 0xd0, 0x66, + 0xac, 0x9f, 0x20, 0x00, 0x11, 0xd3, 0x66, 0x39, 0x96, 0x64, 0xce, 0x06, 0xa1, 0x8f, 0xa9, 0x4a, + 0x00, 0x2a, 0xaf, 0x82, 0x2a, 0x64, 0xb9, 0x78, 0x32, 0x2b, 0x15, 0x84, 0x54, 0x44, 0x3c, 0xa9, + 0x91, 0xaf, 0x01, 0xa8, 0x1b, 0x39, 0x09, 0x60, 0x16, 0x01, 0xb3, 0x86, 0x71, 0xc1, 0x9a, 0x6d, + 0x46, 0x0e, 0xf5, 0xed, 0x4e, 0x13, 0xf7, 0x9b, 0xe5, 0x98, 0x45, 0x50, 0xde, 0x81, 0xd9, 0x20, + 0x1f, 0xdd, 0x75, 0xa4, 0xbd, 0x6e, 0x56, 0x82, 0x5c, 0x78, 0x19, 0x2c, 0xcb, 0x54, 0x15, 0x61, + 0xd5, 0x14, 0x26, 0xd5, 0x24, 0x90, 0x63, 0x98, 0x43, 0xd0, 0x1c, 0x86, 0x29, 0xc5, 0x90, 0x40, + 0x32, 0x1e, 0x82, 0x10, 0x22, 0x20, 0x29, 0x8b, 0x01, 0x0b, 0x3e, 0xf5, 0x28, 0xc6, 0xd2, 0x6d, + 0xe5, 0xb2, 0x36, 0x8f, 0xa7, 0xb4, 0x6c, 0xce, 0xa7, 0xca, 0x6d, 0x29, 0x7b, 0x0f, 0x41, 0x65, + 0x2e, 0x8d, 0xa7, 0x41, 0xdc, 0xa6, 0xb5, 0x1b, 0xbc, 0x83, 0x16, 0x35, 0xd1, 0xc4, 0x5a, 0xda, + 0xc4, 0x5a, 0x33, 0xd6, 0x3e, 0xb9, 0x66, 0x02, 0x07, 0xf3, 0x15, 0xd6, 0x77, 0x46, 0x6c, 0x15, + 0xb6, 0x6a, 0x0b, 0x71, 0x6d, 0x10, 0x23, 0x08, 0x85, 0x11, 0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0x77, 0x2f, 0x2f, 0xfa, 0x2e, + 0x4c, 0xed, 0xd8, 0x0e, 0x65, 0x51, 0x48, 0xc6, 0x14, 0x79, 0x6c, 0xf1, 0x6f, 0x73, 0xdb, 0x0b, + 0x64, 0x5e, 0x4e, 0x4c, 0x28, 0xc8, 0xd6, 0xd5, 0xbd, 0x72, 0xe6, 0x76, 0xbb, 0xc4, 0x77, 0xae, + 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x9b, 0x03, 0x1c, 0x09, 0x2e, 0x0e, 0x00, 0x00, } diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index 1370446fb92..ae91750b167 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -18,6 +18,7 @@ import ( "github.com/gengo/grpc-gateway/runtime" "github.com/gengo/grpc-gateway/utilities" "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/empty" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -405,7 +406,7 @@ func request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshal } func request_ABitOfEverythingService_Timeout_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq EmptyMessage + var protoReq empty.Empty var metadata runtime.ServerMetadata msg, err := client.Timeout(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 1ebfc631bdf..addd2ebb3bd 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -3,6 +3,7 @@ option go_package = "examplepb"; package gengo.grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; import "examples/sub/message.proto"; import "examples/sub2/message.proto"; @@ -45,7 +46,7 @@ message ABitOfEverything { sint64 sint64_value = 18; repeated string repeated_string_value = 19; oneof oneof_value { - EmptyMessage oneof_empty = 20; + google.protobuf.Empty oneof_empty = 20; string oneof_string = 21; } @@ -56,9 +57,6 @@ message ABitOfEverything { string nonConventionalNameValue = 26; } -message EmptyMessage { -} - // NumericEnum is one or zero. enum NumericEnum { // ZERO means 0 @@ -85,13 +83,13 @@ service ABitOfEverythingService { get: "/v1/example/a_bit_of_everything/{uuid}" }; } - rpc Update(ABitOfEverything) returns (EmptyMessage) { + rpc Update(ABitOfEverything) returns (google.protobuf.Empty) { option (google.api.http) = { put: "/v1/example/a_bit_of_everything/{uuid}" body: "*" }; } - rpc Delete(sub2.IdMessage) returns (EmptyMessage) { + rpc Delete(sub2.IdMessage) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/example/a_bit_of_everything/{uuid}" }; @@ -114,7 +112,7 @@ service ABitOfEverythingService { body: "*" }; } - rpc Timeout(EmptyMessage) returns (EmptyMessage) { + rpc Timeout(google.protobuf.Empty) returns (google.protobuf.Empty) { option (google.api.http) = { get: "/v2/example/timeout", }; diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index e1ccff0b9da..801180b197c 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -252,7 +252,7 @@ "200": { "description": "Description", "schema": { - "$ref": "#/definitions/examplepbEmptyMessage" + "$ref": "#/definitions/protobufEmpty" } } }, @@ -275,7 +275,7 @@ "200": { "description": "Description", "schema": { - "$ref": "#/definitions/examplepbEmptyMessage" + "$ref": "#/definitions/protobufEmpty" } } }, @@ -348,7 +348,7 @@ "200": { "description": "Description", "schema": { - "$ref": "#/definitions/examplepbEmptyMessage" + "$ref": "#/definitions/protobufEmpty" } } }, @@ -450,7 +450,7 @@ "format": "string" }, "oneof_empty": { - "$ref": "#/definitions/examplepbEmptyMessage" + "$ref": "#/definitions/protobufEmpty" }, "oneof_string": { "type": "string", @@ -502,9 +502,6 @@ }, "title": "Intentionaly complicated message type to cover much features of Protobuf.\nNEXT ID: 27" }, - "examplepbEmptyMessage": { - "type": "object" - }, "examplepbNumericEnum": { "type": "string", "enum": [ @@ -514,6 +511,11 @@ "default": "ZERO", "description": "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1" }, + "protobufEmpty": { + "type": "object", + "description": "service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.", + "title": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:" + }, "sub2IdMessage": { "type": "object", "properties": { diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 35da7c4206e..81d47454bff 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -19,7 +19,6 @@ It is generated from these files: It has these top-level messages: SimpleMessage ABitOfEverything - EmptyMessage EmptyProto NonEmptyProto UnaryProto diff --git a/examples/examplepb/stream.pb.go b/examples/examplepb/stream.pb.go index 3a8bd19e22c..9c9688f8a1d 100644 --- a/examples/examplepb/stream.pb.go +++ b/examples/examplepb/stream.pb.go @@ -8,6 +8,7 @@ import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gengo/grpc-gateway/third_party/googleapis/google/api" +import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" import gengo_grpc_gateway_examples_sub "github.com/gengo/grpc-gateway/examples/sub" import ( @@ -32,7 +33,7 @@ const _ = grpc.SupportPackageIsVersion2 type StreamServiceClient interface { BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error) - List(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (StreamService_ListClient, error) + List(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (StreamService_ListClient, error) BulkEcho(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkEchoClient, error) } @@ -55,7 +56,7 @@ func (c *streamServiceClient) BulkCreate(ctx context.Context, opts ...grpc.CallO type StreamService_BulkCreateClient interface { Send(*ABitOfEverything) error - CloseAndRecv() (*EmptyMessage, error) + CloseAndRecv() (*google_protobuf1.Empty, error) grpc.ClientStream } @@ -67,18 +68,18 @@ func (x *streamServiceBulkCreateClient) Send(m *ABitOfEverything) error { return x.ClientStream.SendMsg(m) } -func (x *streamServiceBulkCreateClient) CloseAndRecv() (*EmptyMessage, error) { +func (x *streamServiceBulkCreateClient) CloseAndRecv() (*google_protobuf1.Empty, error) { if err := x.ClientStream.CloseSend(); err != nil { return nil, err } - m := new(EmptyMessage) + m := new(google_protobuf1.Empty) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } -func (c *streamServiceClient) List(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (StreamService_ListClient, error) { +func (c *streamServiceClient) List(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (StreamService_ListClient, error) { stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[1], c.cc, "/gengo.grpc.gateway.examples.examplepb.StreamService/List", opts...) if err != nil { return nil, err @@ -145,7 +146,7 @@ func (x *streamServiceBulkEchoClient) Recv() (*gengo_grpc_gateway_examples_sub.S type StreamServiceServer interface { BulkCreate(StreamService_BulkCreateServer) error - List(*EmptyMessage, StreamService_ListServer) error + List(*google_protobuf1.Empty, StreamService_ListServer) error BulkEcho(StreamService_BulkEchoServer) error } @@ -158,7 +159,7 @@ func _StreamService_BulkCreate_Handler(srv interface{}, stream grpc.ServerStream } type StreamService_BulkCreateServer interface { - SendAndClose(*EmptyMessage) error + SendAndClose(*google_protobuf1.Empty) error Recv() (*ABitOfEverything, error) grpc.ServerStream } @@ -167,7 +168,7 @@ type streamServiceBulkCreateServer struct { grpc.ServerStream } -func (x *streamServiceBulkCreateServer) SendAndClose(m *EmptyMessage) error { +func (x *streamServiceBulkCreateServer) SendAndClose(m *google_protobuf1.Empty) error { return x.ServerStream.SendMsg(m) } @@ -180,7 +181,7 @@ func (x *streamServiceBulkCreateServer) Recv() (*ABitOfEverything, error) { } func _StreamService_List_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(EmptyMessage) + m := new(google_protobuf1.Empty) if err := stream.RecvMsg(m); err != nil { return err } @@ -253,25 +254,25 @@ var _StreamService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/stream.proto", fileDescriptor2) } var fileDescriptor2 = []byte{ - // 306 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xad, 0x48, 0xcc, - 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x87, 0x32, 0x0a, 0x92, 0xf4, 0x8b, 0x4b, 0x8a, 0x52, 0x13, 0x73, - 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x54, 0xd3, 0x53, 0xf3, 0xd2, 0xf3, 0xf5, 0xd2, 0x8b, - 0x0a, 0x92, 0xf5, 0xd2, 0x13, 0x4b, 0x52, 0xcb, 0x13, 0x2b, 0xf5, 0x60, 0x7a, 0xf4, 0xe0, 0x7a, - 0xa4, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, - 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0x86, 0x48, 0xe9, 0x60, 0xb1, 0x25, 0x31, - 0x3e, 0x29, 0xb3, 0x24, 0x3e, 0x3f, 0x2d, 0x3e, 0xb5, 0x2c, 0xb5, 0xa8, 0xb2, 0x24, 0x23, 0x33, - 0x2f, 0x1d, 0xaa, 0x5a, 0x0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 0x53, 0xd5, 0x72, 0xcb, 0x02, - 0x00, 0x00, + // 320 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x90, 0x3b, 0x4e, 0x2b, 0x31, + 0x14, 0x86, 0xe5, 0x7b, 0x11, 0x02, 0x23, 0x1a, 0x17, 0x14, 0x06, 0x29, 0x22, 0x02, 0xf1, 0x10, + 0x3a, 0x0e, 0x50, 0x20, 0xd1, 0x11, 0x94, 0x0e, 0x44, 0x91, 0x8e, 0x26, 0xb2, 0xa3, 0x13, 0xc7, + 0x22, 0x33, 0xb6, 0xc6, 0x4e, 0x20, 0x6d, 0x56, 0x80, 0xc4, 0x02, 0x58, 0x0f, 0x35, 0x5b, 0x60, + 0x21, 0x38, 0xf3, 0xaa, 0x02, 0x04, 0xba, 0x19, 0x9f, 0xd7, 0xf7, 0x7f, 0xb4, 0x81, 0x4f, 0x32, + 0x71, 0x23, 0xf4, 0xa2, 0xfc, 0x70, 0x4a, 0xf8, 0x90, 0xa1, 0x4c, 0xc0, 0x65, 0x36, 0x58, 0xb6, + 0xaf, 0x31, 0xd5, 0x16, 0x74, 0xe6, 0xfa, 0xa0, 0x65, 0xc0, 0x47, 0x39, 0x85, 0x6a, 0x06, 0xea, + 0x19, 0xbe, 0xa3, 0xad, 0xd5, 0x23, 0x14, 0xd2, 0x19, 0x21, 0xd3, 0xd4, 0x06, 0x19, 0x8c, 0x4d, + 0x7d, 0xb1, 0x84, 0x6f, 0x97, 0xd5, 0xfc, 0x4f, 0x8d, 0x07, 0x02, 0x13, 0x17, 0xa6, 0x65, 0xf1, + 0x64, 0x01, 0x82, 0xec, 0x29, 0x13, 0x7a, 0x76, 0xd0, 0xc3, 0x09, 0x66, 0xd3, 0x30, 0x34, 0xa9, + 0x2e, 0xbb, 0x79, 0xdd, 0xed, 0xc7, 0x4a, 0x24, 0xe8, 0xbd, 0xd4, 0x58, 0xd4, 0xce, 0xde, 0xfe, + 0xd3, 0xcd, 0x6e, 0x0e, 0xdf, 0xc5, 0x6c, 0x62, 0xfa, 0xc8, 0x9e, 0x09, 0xa5, 0xed, 0xf1, 0xe8, + 0xe1, 0x3a, 0x3e, 0x06, 0x64, 0x17, 0xb0, 0x54, 0x1a, 0xb8, 0x6a, 0x9b, 0x70, 0x37, 0xe8, 0xd4, + 0xb7, 0xf9, 0x16, 0x14, 0x09, 0xa0, 0x4a, 0x00, 0x9d, 0x79, 0x82, 0xa6, 0x98, 0xbd, 0x7f, 0xbc, + 0xfc, 0x3b, 0x6a, 0xee, 0x89, 0xc9, 0x69, 0x85, 0xbf, 0x08, 0x5e, 0xa8, 0x08, 0x71, 0x49, 0x8e, + 0x0f, 0x09, 0x9b, 0x11, 0xba, 0x72, 0x63, 0x7c, 0x60, 0x5f, 0xec, 0xe4, 0x7f, 0x85, 0x6c, 0x1e, + 0xe4, 0x30, 0xbb, 0xac, 0xf1, 0x03, 0x4c, 0x8b, 0xb0, 0x57, 0x42, 0xd7, 0xe6, 0x5e, 0x3a, 0xfd, + 0xa1, 0x65, 0xf0, 0xed, 0xc1, 0xa8, 0x19, 0xa2, 0xd4, 0x38, 0x77, 0x5b, 0xc8, 0xe6, 0xbf, 0xec, + 0x5f, 0x5e, 0x12, 0x46, 0x9a, 0x5c, 0x52, 0x8b, 0xb4, 0x37, 0xee, 0xd7, 0xeb, 0xa8, 0x6a, 0x35, + 0x57, 0x74, 0xfe, 0x19, 0x00, 0x00, 0xff, 0xff, 0xde, 0x54, 0xd1, 0xb6, 0xae, 0x02, 0x00, 0x00, } diff --git a/examples/examplepb/stream.pb.gw.go b/examples/examplepb/stream.pb.gw.go index f5bd60cea06..c6fcebe55ab 100644 --- a/examples/examplepb/stream.pb.gw.go +++ b/examples/examplepb/stream.pb.gw.go @@ -17,6 +17,7 @@ import ( "github.com/gengo/grpc-gateway/runtime" "github.com/gengo/grpc-gateway/utilities" "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/empty" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -70,7 +71,7 @@ func request_StreamService_BulkCreate_0(ctx context.Context, marshaler runtime.M } func request_StreamService_List_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (StreamService_ListClient, runtime.ServerMetadata, error) { - var protoReq EmptyMessage + var protoReq empty.Empty var metadata runtime.ServerMetadata stream, err := client.List(ctx, &protoReq) diff --git a/examples/examplepb/stream.proto b/examples/examplepb/stream.proto index 989bbf01480..dbf5ac4633d 100644 --- a/examples/examplepb/stream.proto +++ b/examples/examplepb/stream.proto @@ -3,18 +3,19 @@ option go_package = "examplepb"; package gengo.grpc.gateway.examples.examplepb; import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; import "examples/examplepb/a_bit_of_everything.proto"; import "examples/sub/message.proto"; // Defines some more operations to be added to ABitOfEverythingService service StreamService { - rpc BulkCreate(stream ABitOfEverything) returns (EmptyMessage) { + rpc BulkCreate(stream ABitOfEverything) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v1/example/a_bit_of_everything/bulk" body: "*" }; } - rpc List(EmptyMessage) returns (stream ABitOfEverything) { + rpc List(google.protobuf.Empty) returns (stream ABitOfEverything) { option (google.api.http) = { get: "/v1/example/a_bit_of_everything" }; diff --git a/examples/integration_test.go b/examples/integration_test.go index 659eec0acd0..60599ba714d 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -18,6 +18,7 @@ import ( "github.com/gengo/grpc-gateway/runtime" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/empty" "golang.org/x/net/context" "google.golang.org/grpc/codes" ) @@ -363,7 +364,7 @@ func testABEBulkCreate(t *testing.T) { t.Logf("%s", buf) } - var msg gw.EmptyMessage + var msg empty.Empty if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil { t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err) return diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index 5027e01e77d..64ae39c6387 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -9,6 +9,7 @@ import ( sub "github.com/gengo/grpc-gateway/examples/sub" sub2 "github.com/gengo/grpc-gateway/examples/sub2" "github.com/golang/glog" + "github.com/golang/protobuf/ptypes/empty" "github.com/rogpeppe/fastuuid" "golang.org/x/net/context" "google.golang.org/grpc" @@ -87,7 +88,7 @@ func (s *_ABitOfEverythingServer) BulkCreate(stream examples.StreamService_BulkC "foo": "foo2", "bar": "bar2", })) - return stream.SendAndClose(new(examples.EmptyMessage)) + return stream.SendAndClose(new(empty.Empty)) } func (s *_ABitOfEverythingServer) Lookup(ctx context.Context, msg *sub2.IdMessage) (*examples.ABitOfEverything, error) { @@ -113,7 +114,7 @@ func (s *_ABitOfEverythingServer) Lookup(ctx context.Context, msg *sub2.IdMessag return nil, grpc.Errorf(codes.NotFound, "not found") } -func (s *_ABitOfEverythingServer) List(_ *examples.EmptyMessage, stream examples.StreamService_ListServer) error { +func (s *_ABitOfEverythingServer) List(_ *empty.Empty, stream examples.StreamService_ListServer) error { s.m.Lock() defer s.m.Unlock() @@ -143,7 +144,7 @@ func (s *_ABitOfEverythingServer) List(_ *examples.EmptyMessage, stream examples return nil } -func (s *_ABitOfEverythingServer) Update(ctx context.Context, msg *examples.ABitOfEverything) (*examples.EmptyMessage, error) { +func (s *_ABitOfEverythingServer) Update(ctx context.Context, msg *examples.ABitOfEverything) (*empty.Empty, error) { s.m.Lock() defer s.m.Unlock() @@ -153,10 +154,10 @@ func (s *_ABitOfEverythingServer) Update(ctx context.Context, msg *examples.ABit } else { return nil, grpc.Errorf(codes.NotFound, "not found") } - return new(examples.EmptyMessage), nil + return new(empty.Empty), nil } -func (s *_ABitOfEverythingServer) Delete(ctx context.Context, msg *sub2.IdMessage) (*examples.EmptyMessage, error) { +func (s *_ABitOfEverythingServer) Delete(ctx context.Context, msg *sub2.IdMessage) (*empty.Empty, error) { s.m.Lock() defer s.m.Unlock() @@ -166,7 +167,7 @@ func (s *_ABitOfEverythingServer) Delete(ctx context.Context, msg *sub2.IdMessag } else { return nil, grpc.Errorf(codes.NotFound, "not found") } - return new(examples.EmptyMessage), nil + return new(empty.Empty), nil } func (s *_ABitOfEverythingServer) Echo(ctx context.Context, msg *sub.StringMessage) (*sub.StringMessage, error) { @@ -220,7 +221,7 @@ func (s *_ABitOfEverythingServer) DeepPathEcho(ctx context.Context, msg *example return msg, nil } -func (s *_ABitOfEverythingServer) Timeout(ctx context.Context, msg *examples.EmptyMessage) (*examples.EmptyMessage, error) { +func (s *_ABitOfEverythingServer) Timeout(ctx context.Context, msg *empty.Empty) (*empty.Empty, error) { select { case <-ctx.Done(): return nil, ctx.Err()